HTML pre-processor

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 WWW 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.

Directive syntax

The syntax follows closely that used by the NCSA httpd WWW server, although not as many directives are supported (yet). 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/tag. Generally the effect of a command is to produce additional text to be inserted in the document.

Directive commands

The BEGIN directive marks the start of a region that may be selectively included with a part-qualified INCLUDE directive. A single BEGIN or END directive may specifiy multiple part names to begin or end at that point

The ECHO command inserts special variables in the stream.
Number of times document accessed, the access count is saved in the file www_root:[000000]accesses.dat.

Number of times document accessed with suffix(e.g. 1st)

Current system time

Filename (sans path) of current document

Value of specified DCL symbol or logical

Hardware model number

Last-modified time of current document

Hostname of current server

Server software version string

Operating system version number

The END directive marks the end of a region started by a previous BEGIN directive (see BEGIN). A file may specify more than one region with matching BEGIN/END pairs.

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

If the preprocessor executable was built using the DEC C compiler, you can follow the file="fname" or virtual="path" tag with and fmt="fmt-str" tag. If a format string is specified, the date is formatted using strftime() rather than ctime(). The specified format is used as the format string for a call to strftime()

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.

The INCLUDE command inserts the content of another document at the current point in the document being pre-processed. Optionally, you may specify an part tag and name and only the named regions (see BEGIN and END directives) in the file will be inserted.


Including a file
<!--#include file="open_hours.html"-->
<!--#include file="open_hours.html" part="holiday"-->
<!--#include virtual="/wasd_root/src/osu/admin/open_hours.html"-->
(file: This TEXT is actually from a separate file. )
(virt: This TEXT is actually from a separate file. )
(virt(rel): This TEXT is actually from a separate file. )

File attributes
<!--#fsize file="portrait.gif"-->
<!--#flastmod virtual="/wasd_root/src/osu/admin/open_hours.html" fmt="%I:%M:%S %p"-->
(Included size: 54 bytes, date: 06-Apr-2021 09:25:31)
(Alt. format lastmod: 09:25:31 AM)

Current document attributes
<!--#echo var="DOCUMENT_NAME"-->
<!--#echo var="LAST_MODIFIED[=fmt]"-->
<!--#echo var="ACCESSES"-->
<!--#echo var="ACCESSES_ORDINAL;5"-->
(document: WASD_ROOT:[src.osu]preproc.htmlx, date: 06-Apr-2021 09:25:31, 26,859th access)
(document: WASD_ROOT:[src.osu]preproc.htmlx, date: Tuesday, April 06, 2021 09:25:31 AM, 26,859 accesses)

Current time
<!--#echo var="DATE_LOCAL"--> (25-Oct-2021 06:56:30)
<!--#echo var="DATE_LOCAL=%B %d, %Y %I:%M:%S %p"--> (alt format: October 25, 2021 06:56:30 AM)

Miscellaneous echo vars
<!--#echo var="SERVER_NAME"-->
<!--#echo var="SERVER_VERSION"-->
<!--#echo var="VMS_VERSION"-->
<!--#echo var="HW_NAME"-->
(Host is a AlphaServer DS20 running the HTTPd-WASD/11.3.0 OpenVMS/AXP HTTP server under VMS V8.4 )

David Jones, Ohio State University