All SSI directives have the format:
<!--#command parameter="value" ... -->
Each of the symbols is important; be careful not to forget the pound sign (#) or the dual dashes (--). Also, it is recommended that you place whitespace between the final arguments and the closing dashes to prevent it from being interpreted as part of an SSI argument.
Following is a list of the primary server-side directives, the parameters they take, and their function.
config |
config errmsg|sizefmt|timefmt="string"
Modifies various aspects of SSI.
<!--#config errmsg="Error: File not found" -->
echo |
echo encoding="type" var="environment_variable"
Inserts value of special SSI variables, as well as other CGI environment variables. For example:
<H1>Welcome to my server at <!--#echo var="SERVER_NAME" -->...</H1>
exec |
exec cmd|cgi="string"
Executes external programs and inserts output in the current document.
For example:
<!--#exec cmd="/bin/finger $REMOTE_USER@$REMOTE_HOST"--> This page has been accessed <!--#exec cgi="/cgi-bin/counter.pl"--> times.
flastmod |
flastmod file="path"
Inserts the last modification date and time for a specified file.
The file was last modified on <!--#flastmod file="/mybook.ps"-->.
You can specify the format of the date and time returned using the config directive with the timefmt argument; timefmt takes a wide range of values described in Section 13.4 later in this chapter.
fsize |
fsize file|virtual="path"
Inserts the size of a specified file.
For example:
The size of the file is <!--#fsize file="/mybook.ps"--> bytes. <!--#fsize virtual="/personal/mydata.txt"-->
include |
include file|virtual="path"
Inserts text of document into current file.
For example:
<!--#include file="stuff.html" --> <!--#include virtual="/personal/stuff.html"-->
printenv |
printenv
Prints all environment variables on the server.
For example:
<!--#printenv-->
set |
set var="name" value="value"
Sets a server-side variable to a given value.
For example:
<!--#set name="myvar" value="activated"-->
Copyright © 2003 O'Reilly & Associates. All rights reserved.