SSI Examples

This page provides examples of the use of SSI commands showing HTML code while using SSI commands

Config:

  • <!--#config errmsg="Sorry, I can't find that file, please send us an e-mail"--> - Changes the error message output by a server error.
  • <!--#config format="abbrev"--> - When the #fsize command is used, the file size will be expressed in rounded kilobytes.
  • <!--#config timefmt="A %B %d %Y %r"--> - Will list time in format as the example, "Friday November 12, 1999 10:23:20 PM" when the #flastmod command is used or the LAST_MODIFIED environment variable is displayed.

Echo:

  • <!--#echo var="DOCUMENT_NAME"--> - Outputs the name of the document the script was invoked from.
  • <!--#echo var="LAST_MODIFIED"--> - Outputs the date and time the file was last modified.

Exec:

  • <!--#exec cgi="/cgi-bin/hits.pl"--> - Runs the server side script.hits.pl.
  • <!--#exec cmd="ls -al"--> - Performs a directory listing.

Fsize:

  • <!--#fsize file="main.shtml"--> - Displays the size of the file "main.html".

Flastmod

  • <!--#flastmod file="main.shtml"--> - Displays the date the file was last modified.

Flastmod may be used as follows:

<H3>The last time main.shtml was modified was on <!--#flastmod filer="main.shtml"-->.</H3>

Include

  • <!--#include file="more.html"--> - Includes the contents of the more.html file in the current file