The current time in College Station is:
Saturday, 26-May-2012 10:58:06 CDT
Using SSI
Server-side includes allow a document to have variable information.
I.e., instead of editing the file and changing the content, you may
reference other data to be included in the document. Other
data may be modification times, other HTML files (perhaps a standard
header/footer format) or other information.
SSI is activated only for those files whose suffix is ".shtml".
Normal HTML files (those ending with .html) may contain SSI
commands, but they will be ignored. In other words, you must rename
your files from filename.html to filename.shtml to
activate SSI.
SSI HTML syntax
The basic syntax is
<!--#keyword tag1="name" tag2="name" ...-->
The popular use of SSI is to include other documents and to display
the time a file was last modified. The following
keywords will be most helpful for these tasks:
- echo
- The echo keyword allows the value of various variables to
be displayed (included). echo recognizes one tag, var,
which has a name value set to the name of the variable to display.
Ex: <!--#echo var="LAST_MODIFIED"--> would include
that date and time that the current HTML document was last changed.
- include
- include allows other HTML documents (which may contain
SSI commands, too) to be included into the current document. The
include keyword recognizes two tags: virtual and
file.
- Virtual documents are those listed as in a
URL: The virtual path of
http://www.univ.edu/topic/index.html is simply
"/topic/index.html". The difference between a virtual path
and a URL is that the virtual filename will exist on the
server from which the current HTML document resides, whereas
a URL specifies a particular host.
- File tags refer to an actual file relative to the current
document. ../ notation is not allowed, so the path
is relative to the current virtual directory. Files in
subdirectories may be accessed, but nothing "above".
The virtual keyword is probably the most versatile of the
two.
Ex: <!--#include virtual="header.html"-->
would include header.html from the current directory.
- flastmod
- flastmod prints the last modification date of the
specified file, which differs from the echo command
described above in the fact that echo LAST_MODIFIED
refers to the current web document. flastmod recognizes
the same two tags as include.
- fsize
- fsize reports the size of the specified file. Valid tags
are virtual and file, as with include.
A good use is to warn the user when a significant file will be
transferred - place this include inside ()'s after the anchor in
the text.
Examples
- <!--#config sizefmt="abbrev"-->
-
- <!--#fsize virtual="/~brentb/SSI.shtml"-->
- [an error occurred while processing this directive]
- <!--#config sizefmt="bytes"-->
-
- <!--#fsize virtual="/~brentb/SSI.shtml"-->
- [an error occurred while processing this directive]
bytes
- <!--#flastmod virtual="/~brentb/SSI.shtml"-->
- [an error occurred while processing this directive]
- <!--#echo var="LAST_MODIFIED"-->
- Wednesday, 08-Aug-2001 10:16:44 CDT
- <!--#echo var="DATE_LOCAL"-->
- Saturday, 26-May-2012 10:58:06 CDT
Other Info
Official NCSA HTTPd documents cover
SSI in more detail.
Last modified Wednesday, 08-Aug-2001 10:16:44 CDT