# Directives

## #config

This directive is used to override the default XSSI settings while processing the XSSI file.

### Form 1: `<!-- #config errmsg="error message" -->`

`#config errmsg` is used to change the message sent to the client when an XSSI error occurs. By default, XSSI errors are reported in a detailed manner to allow easy debugging.

### Form 2: `<!-- #config sizefmt="size_format" -->`

`#config sizefmt` controls the way the server displays XSSI file sizes. `size_format` can have two values:

- `ABBREV`: displays file sizes in kilobytes (KB) or megabytes (MB).

- `BYTES`: displays file sizes in bytes. It is the default.

### Form 3: `<!-- #config timefmt="time_format" -->`

`#config timefmt` specifies the format in which XSSI dates are inserted. `time_format` must contain formatting tokens that are substituted by the corresponding parts of the date. The available tokens are listed below with the description of their substitution:

- `%a`: Abbreviated English name for day of the week.

- `%A`: Complete English name for day of the week.

- `%b`: Abbreviated English month name.

- `%B`: Complete English month name.

- `%c`: Date and time representation. It is the equivalent of `%m/%d/%y %H:%M:%S`.

- `%d`: Day of the month (01-31).

- `%e`: Day of the month (1-31). If it is a single digit, it is padded with a space.

- `%H`: Hour in 24-hour format (00-23).

- `%I`: Hour in 12-hour format (01-12).

- `%j`: Day of the year as a decimal number (001-366).

- `%m`: Month as a decimal number (01-12).

- `%M`: Minute as a decimal number (00-59).

- `%p`: A.M. or P.M. indicator for 12-hour format.

- `%S`: Second as a decimal number (00-59).

- `%U`: Week of the year as a number (00-51). Sunday is the first day of the week.

- `%w`: Day of the week as a number (0-6). Sunday is the first day of the week.

- `%W`: Week of the year as a number (00-51). Monday is the first day of the week.

- `%x`: Date representation. It is the equivalent of `%m/%d/%y`.

- `%X`: Time representation. It is the equivalent of `%H:%M:%S`.

- `%y`: Year without the century (00-99).

- `%Y`: Year with the century (0000-9999).

- `%z` and `%Z`: Time zone name; empty if unknown.

- `%%`: Percent sign.

## #echo

### Form: `<!-- #echo var="variable_name" -->`

`#echo` inserts the value of an XSSI environment variable. XSSI environment variables include those set using the `#set` directive, those available for CGI scripts (see "CGI environment variables" in the "CGI, FastCGI, and ISAPI" chapter), and five special variables:

- `DOCUMENT_NAME`: The name of the processed XSSI file.

- `DOCUMENT_URI`: The virtual path to the current processed file.

- `DATE_LOCAL`: The current local date.

- `DATE_GMT`: The current date expressed in UTC (coordinated universal time, formerly known as Greenwich Mean Time, or GMT).

- `LAST_MODIFIED`: The last modification date of the processed file expressed in UTC (coordinated universal time).

If `variable_name` is not a valid XSSI environment variable, the directive is ignored.

## #exec

### Form 1: `<!-- #exec cgi="cgi_file" -->`

`#exec cgi` executes a script and inserts its output. If `cgi_file` begins with a `/`, it is considered as a virtual path and the directive will behave as if it is `<!-- #include virtual="cgi_file" -->`. If `cgi_file` does not begin with a `/`, it is considered as a relative file name and the server will try to locate it inside the directory containing the currently processed XSSI file. If it is found there, `#exec cgi` will behave as if it is `<!-- #include file="cgi_file" -->`. Otherwise, `cgi_file` will be searched inside the virtual paths listed in '#exec cgi' Search Paths in the XSSI Parameters of the current host.

### Form 2: `<!-- #exec cmd="shell_command" -->`

`#exec cmd` executes a shell command and inserts its output. The shell executable path is found in the system environment variable `SHELL`. If this variable is empty or does not exist, `/bin/sh` is used as the default shell.

> Note: `#exec cmd` execution must be used with extreme care. If users can edit or modify HTML pages in your web sites (which is the case if you have a forum or a guestbook for instance), you must disable it. In fact, they can include XSSI tags with dangerous `#exec cmd` directives and remotely invoke them.

## #flastmod

### Form 1: `<!-- #flastmod file="file_name" -->`

`#flastmod file` inserts the last modification date of the file `file_name`. `file_name` is a relative path from the directory containing the processed XSSI file. It file can only be in the same directory or in one of its subdirectories.

### Form 2: `<!-- #flastmod virtual="virt_path" -->`

`#flastmod virtual` inserts the last modification date of the file which virtual path is `virt_path`.

## #fsize

### Form 1: `<!-- #fsize file="file_name" -->`

`#fsize file` inserts the size of the file `file_name`. `file_name` is a relative path from the directory containing the processed XSSI file. It can only be in the same directory or in one of its subdirectories.

### Form 2: `<!-- #fsize virtual="virt_path" -->`

`#fsize virtual` inserts the size of the content resulting from requesting `virt_path` from the server. If `virt_path` is a static file, its size will be inserted. If it is a CGI script or a XSSI file, it is evaluated by the server and the size of the resulting output is inserted.

## #include

### Form 1: `<!-- #include file="file_name" -->`

`#include file` instructs the web server to insert a file which must contain valid HTML contents. `file_name` is a relative path from the directory containing the processed XSSI file. The included file can only be in the same directory or in one of its subdirectories.

### Form 2: `<!-- #include virtual="virt_path" -->`

`#include virtual` inserts the content resulting from requesting `virt_path` from the server. If `virt_path` is a static file, its contents will be included "as is". If it is a CGI script or a XSSI file, it is evaluated by the server and the results are inserted. `virt_path` must contain or generate valid HTML content.

## #printenv

### Form: `<!-- #printenv -->`

`#printenv` outputs the current CGI environment variables. For more information, refer to the "CGI environment variables" section.

## #set

### Form: `<!-- #set var="variable_name" value="variable_value" -->`

`#set` sets the value of the variable `variable_name` to `variable_value`. If no variable called `variable_name` exists, it is created before being set. `#set` can be used to change the value of CGI variables or any already declared variable.