Table 1


Tutorial examples that demonstrate Apache SSI capabilities.

SOURCE HTML RESULT DESCRIPTION
<!--#echo var="DATE_LOCAL"--> Tuesday, 19-Oct-1999 16:02:34 PDT Returns the local date.
<!--#echo var="LAST_MODIFIED"--> Friday, 15-Oct-1999 18:27:37 PDT Returns the last-modified date of a file
<!--#echo var="DOCUMENT_NAME"--> ssi-sidebar.html Returns the filename.
<!--#echo var="DOCUMENT_URI"--> /mfw/consult/web-techniques/ Returns the URI of an HTML document.
ssi-sidebar.html
<!--#exec cmd="date"--> Wed Oct 20 13:24:45 PDT 1999 Executes any UNIX command; the output appears in an HTML document.
<!--#fsize file="ssi-sidebar.html"--> 6K Returns the byte size in a file. The display format (KB, MB) can be changed (see Table 2).
<!--#flastmod file="ssi-sidebar.html"--> Friday, 15-Oct-1999 18:27:37 PDT An alternative way of extracting the last-modified date of a file.
<!--#include file="footer.html"--> ssi-sidebar.html last modified: 10/15/99 18:27 by Suzie T. Scout Includes a standard file (for a logo, header, footer) in an HTML files
<!--#if expr="\"DOCUMENT_URI\" = \"/sub1/a.html\"" -->
in sub1
<!--#elif expr="\"$DOCUMENT_URI\" = \"/sub2/b.html\"" -->
in sub2
<!--#else -->
in neither sub1 nor sub2
<!--#endif -->
in neither sub1 nor sub2 Uses "if-then-else" statements to print certain HTML text based on values of environment variables or other strings.
<!--#set var="msg" value="${msg}
Remote IP: ${REMOTE_ADDR}" -->
<!--#set var="msg" value="${msg}
Browser: ${HTTP_USER_AGENT}" -->
<!--#echo var="msg" -->
Remote IP: 198.71.21.34
Browser : Mozilla/4.0 (compatible;
MSIE 5.0; Windows 95; DigExt)
Sets variables; uses other variables tobuild up bigger strings.