SSI Directives
October 4, 1999
All SSI directives are formatted as
SGML comments
within an HTML document and thus looks something
like the following:
<!--#command tag1="value1" tag2="value2" -->
There are several possible commands that you can use
including the following:
| config |
Controls various aspects of the file parsing. There are
two valid tags:
|
| include |
Inserts the text of a separate document into the parsed
document. For example, if you had a menu bar on every page,
rather than coding the same HTML into every page on your site
(Q: what happens if you change the menu? A: You'd have to
recode every document!) you might write the HTML for the menu
bar in a separate file and use SSI to reference it
in multiple documents using something like:
<!--#include virtual="menu.html" -->
The include command accepts two tags:
- virtual defines a virtual path to a document on
the server.
- file gives a pathname relative to the current
directory.
|
| echo |
Prints the value of one of the 6 special include
variables.
- DOCUMENT_NAME: The current filename.
- DOCUMENT_URI: The virtual path to this document.
- QUERY_STRING_UNESCAPED: The unescaped version of any
search query the client sent, with all shell-special
characters escaped with \.
- DATE_LOCAL: The current date, local time zone.
(This variable is subject to the timefmt parameter to
the config command)
- DATE_GMT: Same as DATE_LOCAL but in Greenwich mean time.
- LAST_MODIFIED: The last modification date of the current
document. (Subject to timefmt like the others).
Note that any dates are formatted according to
timefmt if set by config.
Also note that the only valid tag to this command is
var, whose value is the name of the variable you wish
to echo.
|
| fsize |
Prints the size of the specified file.
The valid tags for this command are the same as those of the
include command and the resulting format of this command can
be defined by the sizefmt parameter in the config command.
|
| flastmod |
Prints the last modification date of the specified file,
subject to the formatting defined by the timefmt
parameter in config. Valid tags are the same as with
the include command. |
| exec |
Executes a given shell command or CGI script. Valid
tags include:
- cmd will execute the given string using the
operating system shell on which the web server is
running.
- cgi will execute the given CGI script
and include its output.
|
SSI (Server Side Includes)
Introduction to the Web Application Development Environment (Tools)
SSI Directives Cont.
|