It should come as no surprise that the function of SSI depends heavily on the configuration of the server. My instructions use SSI commands that work for NCSA HTTPd Server Side Includes, and specifically, those documented in the Apache server's mod_include module.
Server Side Include commands have the following format:
The element is one of the predefined functions that Server Side Includes can perform, such as include or echo.
The command also includes one or more attribute/value pairs that provide the specific parameters to the function.
There are a few important things to note about SSI command syntax:
- The whole command must be enclosed within comment indicators ().
- The comment terminator (-->) must be preceded by a space to make it clear that it is not part of the SSI information.
- Keep the whole command on one line (line breaks between the comment tags may cause the SSI not to function).
- The # symbol is an important part of the command and must not be omitted.
Example: Virtual IncludesThe simplest type of Server Side Include is a "virtual include," which tells the server to add information to a file before sending it to the browser.
The command in the above example uses the include element, which inserts the text of another document into the parsed file. The include element uses the virtual parameter to specify the URL of the document to be inserted, in this case,
navtable.html.
Many webmasters label these fragment files with the
.htmlf suffix to keep them distinct from normal HTML documents, although it's not necessary.
Example: Executing Scriptsexec cmd|cgi="string"
Executes external programs and inserts the output in the current document.
Attributescgi - 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.
One Last Note on Virtual IncludesThe virtual attribute 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.
[ 10-03-2001: Message edited by: Matt Jacob ]