The following section describes the primary Server Side Includes and
their respective attributes.
config errmsg|sizefmt|timefmt="string" | |
Controls various aspects of SSI.
Attributes
- errmsg
-
Defines the default message sent if an error occurs while parsing the
document.
- sizefmt
-
Sets the format to be used when displaying the size of the file.
Valid values are bytes or
abbrev, which rounds the size up to the nearest
kilobyte.
- timefmt
-
Sets the format for dates and times. The full range of formats and
examples are provided in Section 18.8, "Time Formats for SSI Output".
Example
<!-- #config errmsg="Error: File not found" -->
<!-- #config sizefmt="abbrev" -->
echo var="environment or set variable"
| |
Prints (displays in the document) the value of the variable. For an
list of available variables, see Section 18.7, "Include Variables" later in this chapter.
Attributes
- var
-
The value is the name of the variable to print.
Example
<! -- #echo var="DATE_GMT" -- >
Executes an external program and inserts the output in the current
document.
Attributes
- cgi
-
Provides the relative URL path to the CGI script.
- cmd
-
Specifies any shell program on the server. The SSI variables are
available to the command.
Example
You are visitor number <! -- #exec cgi="/cgi-bin/counter.pl" -- >
<!--#exec cmd="/bin/finger $REMOTE_USER@$REMOTE_HOST" -->
fsize file|virtual="path" | |
Inserts the file size of a specified file. The size follows the
sizefmt format configuration.
Attributes
- file
-
Specifies the location of the file as a pathname relative to the
directory of the document being parsed. This attribute is not
recommended for use (it is there for backwards compatibility with old
NCSA scripts).
- virtual
-
Specifies the URL path relative to the current document being parsed.
If it does not begin with a slash ( / ) it is taken to be relative to
the current document.
Example
The size of this file is <!--#fsize file="thisfile.html" -->
flastmod file|virtual="path" | |
Inserts the last modification date of a specified file. The date
follows the timefmt format configuration.
Attributes
- file
-
Specifies the location of the file as a pathname relative to the
directory of the document being parsed. This attribute is not
recommended for use (it is there for backwards compatibility with old
NCSA scripts).
- virtual
-
Specifies the URL path relative to the current document being parsed.
The URL cannot contain a scheme or hostname, only a path (and
optional query string). If it does not begin with a slash ( / ), it
is taken to be relative to the current document.
Example
That file was last modified on
<!--#flastmod virtual="/mydocs/thatfile.html" -->
include file|virtual ="path" | |
Inserts the contents of another document or file into the parsed
file.
Attributes
- file
-
Specifies a path relative to the directory of the parsed file (i.e.,
it cannot include ../ nor can it be an absolute path). The virtual
attribute should always be used in preference to this one. This
attribute is not recommended for use (it is there for backwards
compatibility with old NCSA scripts).
- virtual
-
Specifies a URL relative to the document being parsed. The URL cannot
contain a scheme or hostname. If it does not begin with a slash ( /
), it is taken to be relative to the current document.
Prints out a listing of all existing variables and their values.
Example
<! -- #printenv -- >
Sets the value of a variable.
Attributes
- var
-
The name of the variable to be set.
- value
-
The value given to the variable.
Example
<!--#set var="password" value="mustard" -->