- publishing free software manuals
The Apache HTTP Server Reference Manual
by Apache Software Foundation
Paperback (6"x9"), 862 pages
ISBN 9781906966034
RRP £19.95 ($29.95)

Get a printed copy>>>

10.4  Basic SSI directives

SSI directives have the following syntax:

<!--#element attribute=value attribute=value … -->

It is formatted like an HTML comment, so if you don’t have SSI correctly enabled, the browser will ignore it, but it will still be visible in the HTML source. If you have SSI correctly configured, the directive will be replaced with its results.

The element can be one of a number of things, and we’ll talk some more about most of these in the next installment of this series. For now, here are some examples of what you can do with SSI

10.4.1  Today’s date

<!--#echo var="DATE_LOCAL" -->

The echo element just spits out the value of a variable. There are a number of standard variables, which include the whole set of environment variables that are available to CGI programs. Also, you can define your own variables with the set element.

If you don’t like the format in which the date gets printed, you can use the config element, with a timefmt attribute, to modify that formatting.

<!--#config timefmt="%A %B %d, %Y" -->
Today is <!--#echo var="DATE_LOCAL" -->

10.4.2  Modification date of the file

This document last modified <!--#flastmod file="index.html" -->

This element is also subject to timefmt format configurations.

10.4.3  Including the results of a CGI program

This is one of the more common uses of SSI - to output the results of a CGI program, such as everybody’s favorite, a “hit counter.”

<!--#include virtual="/cgi-bin/counter.pl" -->

ISBN 9781906966034The Apache HTTP Server Reference ManualSee the print edition