Using Server Side Include Commands
Server Side Include (SSI) commands are executed by the server as it parses your HTML file. Server side includes can be used to include the value of various server environment variables within your HTML such as the local date and time. One mightuse a server side include to add a signature file to an HTMLfile or company logo.
HTML files containing SSI must be named with an shtml extension. SSI commands are easy to add to your HTML, but you must follow the syntax exactly:
<!-- exec cgi=/cgi-bin/script.cgi-->
and the name of the HTML file must end with the .shtml extension.
Using the echo Command
The echo command can be used to display the content of the five server side environment variables listed in the table below.
Variable Description
Date_Local Current date and time (determined by server location).
Date_GMT Current date and time in Greenwich Mean Time.
Document_Name File name of the main document.
Document_URI Path and file name of the main document
Last_Modified Date and time the main document was last modified.
Example:
Date and time determined by server location.
eg. <!--#echo var="Date_Local" -->
output: Sunday, 05-Oct-97 01:29:23 EDT
Using the config Command
The config command can be used to configure the standard output of various environment variables. In the followingexample, two SSI commands are used in conjunction to produce an alternative date and time format:eg. <!--#config timefmt="%A, %B %d, %Y %I:%M%p"-->
<!--#echo var="date_local" -->
output: Sunday, October 05, 1997 01:29AM
Here is a breakdown date and time codes used in the example above:
%A Full weekday name
%B Full month name
%d Day of the month
%Y Year
%I Hour
%M Minutes
%p a.m. or p.m.
----------------------------------------------------
Other SSI Commands
The fsize command might be helpful if you were to include a thumbnail image and want to display the actual file size ofthe original image.
eg. <!--#fsize file="image.gif" --> output:10k
The include command can be used to include a signature file orcompany logo within an HTML document. The added document or image will appear as if it were part of the original document.
eg. <!--#include file="any.htm" -->
If the file to be included is in a different directory thanthe SHTML document. use the virtual command argument instead.In the following example, the SHTML document resides in a subdirectory but includes a file within account root directory:
eg. <!--#include virtual="/any.htm" -->
The exec command can be used to execute a CGI script when the web page is loading. In the following example, the scriptdate.pl within the relative path /cgi-bin is executed.
eg. <!--#exec cgi="/cgi-bin/date.pl" -->
