Frequently Asked Questions - Server Side
1. What are
Server Side Includes?
Server-side includes (SSIs) are
simple, HTML-embedded directives that instruct the Web server
to include data in the HTML document. As a shorthand alternative
to CGI, server-side includes can be useful.
First you must create a
page with a .shtml extention. Then SSI is easily implemented
into your Web page by using the following syntax or directives:
Directives can have more than one parameter, and multiple parameters
are separated by white space.
3. What directives
The valid SSI directives are as
Echo inserts the value of one
or more SSI environment variables.
The "include" directive
inserts the text of another document, specified either as a
file or a virtual file. Path must be relative to the current
document in the case of a file, or it can be a virtual path.
<!--#include virtual="/virtual/sample.html" -->
The fsize directive inserts the
size of the file specified by path, in bytes. For example:
This file is <!--#fsize
file="example.ps" --> bytes
Similar to fsize, flastmod inserts
the modification date for the file specified by path. For
This file was last modified
on <!--#flastmod file="example.html"
You can use the config directive
to modify the default SSI behavior. The parameters are
the default error message. For example:
errmsg="Error: Try again." -->
the format for file size data returned by the fsize directive.
The string for this parameter is either "bytes"
for file sizes in bytes, or "abbrev" for file sizes
rounded to the nearest kilobyte. For example:
the format for dates and times returned by the flastmod directive
and the DATE_LOCAL and DATE_GMT variables.
The possible values for this
||Abbreviated day of the week, such as "Sun"
||Unabbreviated day of the week
||Abbreviated month, such as "Jan"
||Two-digit, numerical day of the month, such
as "01" .
||Numerical month, day, and year, such as "01/24/97"
||Numerical day, such as "1"
||24-hour clock hour, such as "17"
||12-hour clock hour, such as "11"
||Numerical day of the year, such as "278"
||Numerical month, such as "11"
||Minutes, such as "08"
||am or pm
||Time, such as "08:23:17 am"
||Seconds, such as "56"
||24-hour time, such as "23:54:56"
||Week of the year, such as "47"
||Numerical day of the week, such as "0"
for Sunday and "7" for Saturday
||Year of the current century, such as "97"
||Abbreviated time zone, such as "PST"
||Skips the next n rules in a sequence
if the current rule matches
||Same as "skip"
||Sets the environment variable VARIABLE
to the value VALUE
||Same as "env"
This directive prints a complete
list of all existing SSI variables and their values. It
has no attributes. For example:
set var="variable" value="value"
This directive sets the value
of an environment variable. For example:
var="country" value="United States" -->
4. What extended
SSI elements are available?
Our server implements extended SSI,
which includes flow control elements much like the ones used in
programming languages. With flow control, you can create
more sophisticated SSI scripts.
There are four flow control elements:
<!--#elif expr="test-condition" -->
The test-condition is one of the following:
||True if the string is not empty
||True if string1 matches string2
||True if string1 does not match string2
||True if test-condition is true
||True if test-condition is false
|test-condition1 && test-condition2
||True if both test-condition1 and
test-condition2 are true
|test-condition1 || test-condition2
||True if either test-condition1 or
test-condition2 is true
| 5. What SSI
environment variables are available?
The filename of the current HTML
document. For example:
This file is called <!--#echo
The URL of the current file. For
This document is located at <!--#echo
An unencoded query string whose
metacharacters are escaped with a backslash (\).
The local date and time. For
Here in San Diego, it is now <!--#echo
The current Greenwich Mean Time.
The current time is <!--#echo
var="DATE_GMT" --> GMT
The date and time when the current
file was last modified. For example:
I last modified this page on <!--#echo
6. What CGI
environment variables can I use with SSI?
The name and version number of
the server software
The host being addressed in this
request, which may be the main host or a virtual host, either
as a fully-qualified domain name or an IP address
The same as SERVER_NAME
MIME-type . . .]
One or more MIME types that the
client can accept
The name, version number, and
platform of the client software
The hostname or IP number of the
client host or proxy server that originated the request
The client-side port number that
originated the request
The IP number of the client host
The remote username, if the script
is subject to basic authentication
The remote username as supplied
by identd, if available
The protocol and version number
used to send the request, which Stronghold also uses in its
response in order to ensure compatibility with the client
The method used in this request,
such as GET or POST
The authentication method used
in this request, if any
The MIME type of any data attached
to the request header
The size, in bytes, of any data
attached to the request header
The URI of the requested script
The absolute path to the requested
The URI of the requested script
The URL of the requested script
The query-string for this transaction,
embedded in the requested URL
can I get more information about Server-Side Includes?
More information on Server-Side
Includes can be found at http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html
8. Can I
use the exec directive to run scripts?
No, due to security reasons that
directive is not available. To run scripts use the include