XSSI Library

Command Listing

A list of common commands on many platforms.

Listing of XSSI Commands

Your order, sir?

When giving commands to your SSI directives, you better understand what they know how to do. Here's the listing of the commands that are understood under XSSIs in Apache 1.2 and higher.

The Full list of commands can be found in the mod_include documentation at Apache.org


Include

The include command 'includes' other HTML files (or plain text files) into your server-parsed HTML file. For this command, there are two ways to refer to the file that needs to be added:

virtual
Using the virtual argument lets the SSI know that you are refering to the file in the same way as the rest of the web would: via it's URL.

Example:
<!--#include virtual="/dir/file.ext"-->
In English, this says, "Include the file 'file.ext' that is in the directory 'dir' at the top of this web server's directories.

file
Using the file argument lets the SSI know that you are refering to the file in the same way as the operating system of the computer would, internally: by it's path name relative to the root of the file system. (The file system's root is almost always different from the web server's root.)

Example:
<!--#include file="subdir/file.ext"-->

Important Note:
It's important to remember that if the file you are including into your document has XSSI commands, it usually needs to have the '.shtml' extension on it.


Config

The config directive controls various aspects of the file parsing. There are two valid tags:

errmsg
errmsg controls what message is sent back to the client if an error occurs while parsing the document. When an error occurs, it is logged in the server's error log.

Example:
<!--#config errmsg="[Danger Will Robinson!]"-->
<!--#include file="does_not_exist.txt"-->

Result: [Danger Will Robinson!]

sizefmt
sizefmt determines the formatting to be used when displaying the size of a file. Valid choices are bytes, for a formatted byte count (formatted as 1,234,567), or abbrev for an abbreviated version displaying the number of kilobytes or megabytes the file occupies.

Example:
<!--#config sizefmt="bytes"-->
<!--#fsize file="sample.txt"-->

Result: 3,005


Echo

Prints the value of one of the envrionment variables. The only valid tag to this command is var, whose value is the name of the variable you wish to echo.

var
var chooses which environment variable to show in the page.

Example:
<!--#echo var="DOCUMENT_NAME"-->

Result: commands.html


fsize

fsize prints the size of the specified file. Valid tags match those of the include command. The resulting format of this command is subject to the sizefmt parameter of the config command.

virtual
Using the virtual argument lets the SSI know that you are refering to the file in the same way as the rest of the web would: via it's URL.

Example:
<!--#fsize virtual="/dir/file.ext"-->
In English, this says, "Show the size of the file 'file.ext' that is in the directory 'dir' at the top of this web server's directories.

file
Using the file argument lets the SSI know that you are refering to the file in the same way as the operating system of the computer would, internally: by it's path name relative to the root of the file system. (The file system's root is almost always different from the web server's root.)

Example:
<!--#fsize file="subdir/file.ext"-->


flastmod

Prints the last modification date of the specified file. Valid tags are the same as with the include command.

virtual
Using the virtual argument lets the SSI know that you are refering to the file in the same way as the rest of the web would: via it's URL.

Example:
<!--#flastmod virtual="/dir/file.ext"-->
In English, this says, "Show the last modification date and time of the file 'file.ext' that is in the directory 'dir' at the top of this web server's directories.

file
Using the file argument lets the SSI know that you are refering to the file in the same way as the operating system of the computer would, internally: by it's path name relative to the root of the file system. (The file system's root is almost always different from the web server's root.)

Example:
<!--#flastmod file="subdir/file.ext"-->

   

A printer-friendly version of this article is available.
This site hand-coded for your protection.