College of Engineering Logo Web Server Logs Student Server Logs Orange bar Main Page General Information Special Events Programs Research Student Information Computer Facility Outreach Xtreme Engineering Jobs Available

Server-side Includes (SSI)

Our NCSA server supports what is called Server Side Includes, and this document bases much of its information from NCSA's documentation. This feature which has been enabled on our server allows users to create documents which can dynamically modify the contents of a page. Some of these features include the following:

  • Including the output of a cgi or regular program
  • Inserting values of some cgi variables.
  • Including the contents of another file into your .html file.

What exactly is SSI?

As mentioned above, server side includes allows users the ease to customize and unify the look of their documents through something like a universal footer file, for example. Unfortunately, because the server has to go through the entire file to look for any directives which are used by the includes, it can slow access to your page particularly if your page is large. One other side effect is that the document is always "new", causing certain web browsers which use caching algorithms to be unable to cache your page, but instead will re-load it every time it is requested.

How to set your files to use SSI

There are two ways to set a file to be recognized by the server as a server-side include file:

  • Turn on the execute-bit of the file. You can do this by typing the following Unix command:
    chmod a+x filename
  • Use the .shtml extension, instead of .html.

SSI Directives

The tags for SSI are written in the same way comments are written in regular HTML. Comments within HTML are usually bracketed with the following:

<!-- ... -->
Instead, however, server side includes uses a specific format of comments, as shown.
<!--#command attribute1="value1" attribute2="value1" -->
A list of the available commands and attributes are given below:
config
This command changes the different aspects of the file parsing.
  • Attributes:
    errmsg
    This attribute is used to define the error message when there is an error during the parsing process.
    timefmt
    This attribute allows you to specify the time format used for those commands which print times or dates. See the on-line manual pages for the system call strftime().
    sizefmt
    This attribute defines how file sizes (see below) are displayed. Valid values for this attribute are bytes, which gives a formatted count, or abbrev which displays the number of kilo- or megabytes.
include
  • Attributes:
    virtual
    You can specify the URI of a file which is accessible locally on this server. The URI is the portion of the URL following the host the script following the name of the script.)

Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)

Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu


Last updated on Monday, February 05, 2001
Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility
All rights reserved.