OIT Tech 32px
pagemasters' toolbox -- static pages

Using Server-Side Includes


Appendix VII Table of Contents


A.  Introduction and Caution

B.  Directive Syntax

C.  Directive Commands

D.  Examples


 

A.  Introduction and Caution


The HTML pre-processor is used to provide dynamic information inside of a standard HTML (HyperText Markup Language) document.  The pre-processor is a script, run by the server, which takes the requested document as input and returns a standard HTML document for the server to send to the client.  The script scans the input document for special pre-processor "directives," which are replaced by dynamic data based upon the particular directive.  The script is applied to all documents whose file names end in ".shtml" (on ww2.ohio.edu, only, the script is also applied to all documents whose file names end in ".htmlx" -- so as to be compatible with sites originally published from the old "VMS Front Door" server; ".shtml" is standard and should be used for all new subsites where this feature is being applied).

Cautions!  --  This feature is enabled on our servers primarily to support sites that were built using the feature on the previous static-page servers.  There are a number of good reasons not to use it; just because it is possible, and we have documented how to do, does not mean that you should use it for your site.  In particular:

  • The disk traffic, the CPU usage, and the consequent time delays mean that pages whose filename types trigger the pre-processing will be sent to the browser more slowly.  This effect is particularly pronounced for larger files, whether or not they actually use any of the directives.

  • Experience has demonstrated that it is routinely quite difficult for a new pagemaster who inherits a site built using these features to understand the structure of the site and the various files' dependencies on each other.

We therefore strongly urge that you think long and hard before adding them to any site other than your own personal pages on the "people2" server.  If you do decide to go ahead and use them, then be sure to create, maintain, and preserve documents describing, in detail, how you are using them to build your site.

If you have inherited responsibility for a site that is already using these features, please do not hesitate to contact OIT for assistance in planning to use alternatives, by e-mail to servicedesk@ohio.edu.

 

B.  Directive syntax


The directive is enclosed within an HTML comment and takes the form: <!--#command [[tag="value"] ...]-->

The command and tag keywords are case insensitive.  The tag value may or may not be case sensitive, depending upon the command and tag.  Generally the effect of a command is to produce additional text to be inserted in the document.

 

C.  Directive commands


ECHO:  The ECHO command inserts special variables in the stream. 

  • ACCESSES[;#] Number of times document accessed (the access count is saved in a file on the server). 

  • ACCESSES_ORDINAL[;#] Number of times document accessed with suffix (e.g. 1st) 

  • DATE_LOCAL[=fmt] Current system time 

  • DOCUMENT_NAME Filename (sans path) of current document

  • LAST_MODIFIED[=fmt] Last-modified time of current document

 

FLASTMOD:  The FLASTMOD command inserts the file modification date of a specified file at the current point in the document being pre-processed.

 

FSIZE:  The FSIZE command inserts the file size in bytes (as best as can be determined) of a specified file at the current point in the document being pre-processed.

 

INCLUDE:  The INCLUDE command inserts the content of another document at the current point in the document being pre-processed.

 

D.  Examples


See the demo page.