[an error occurred while processing this directive]

Server Side Includes

The WebCom WWW Server allows you to create documents which include other documents and various dynamically generated information, such as the current date, the file's last modification date, and the size or last modification of other files. Note: The "exec" command is not available, due to security considerations.

Special File Extension Necessary

Files utilizing includes must end in ".shtml". If they do not, the includes will be ignored.

The "include" format

All include directives are formatted as SGML comments within your document. This is in case the document should ever be transferred without being parsed.

Each directive has the following format:

<!--#command tag1="value1" tag2="value2" -->

Each command takes different arguments, most only accept one tag at a time. Here is a breakdown of the commands and their associated tags:

include
config
other commands

include

Inserts the text of a specified document into the body of the current document. Is commonly used for including headers or footers in web pages.

<!--#include virtual="/dir/file.ext"-->
<!--#include file="subdir/file.ext"-->

NOTES:
(Please read!)
  • Do not leave any spaces between the equal ("=") sign and the file it specifies. Doing so will cause an error message to be displayed.
  • Any included file is subject to the usual access authorization controls.
  • If you use a domain name you must use the virtual command. file only works with WebCom URLs.
  • virtual
    gives a virtual path to a document on the server. A normal file or another parsed document may be accessed using this tag. Please note that the path of this file name should be the URL of the file, with the domain name removed. For instance, if the URL of a file is "http://www.your-domain.com/products/footer.txt"
    then the path to use with this include directive would be:
    "/products/footer.txt"

    Example: <!--#include virtual="/virtual_sample.txt"-->

    This is a sample text file. It was included in this file by the include virtual tag:
    <!--#include virtual="/virtual_sample.txt"-->.

    This paragraph includes a hotlink, and tags such as bold and emphasis.

    file
    gives a pathname relative to the current directory. ../ cannot be used in this pathname, nor can absolute paths be used. (If you need to refer to a file in a higher directory, you might consider using virtual described above.) As above, you can send other parsed documents.

    Example: <!--#include file="sample.txt"-->

    This is a sample text file. It was included in this file by the include file tag: <!--#include file="sample.txt"-->.

    This paragraph includes a hotlink, and tags such as bold and emphasis.

    Other Commands

    echo
    prints the value of one of the include variables (select the hotlink for definitions). The only valid tag to this command is var, whose value is the name of the variable you wish to echo.

    <!--#echo var="DOCUMENT_NAME"-->

    Result: welcome.shtml

    fsize
    prints the size of the specified file. Valid tags match those of the include command. The resulting format of this command is subject to the sizefmt parameter of the config command.

    <!--#fsize file="sample.txt"-->

    Result: 1K (without sizefmt)

    <!--#config sizefmt="bytes"-->
    <!--#fsize file="sample.txt"-->

    Result: 329 (with sizefmt)

    flastmod
    prints the last modification date of the specified file. Valid tags are the same as with the include command.

    <!--#flastmod file="sample.txt"-->

    Result: Thursday, 13-Jul-95 14:40:33

    config

    The config directive controls various aspects of the file parsing. There are two valid tags:

    errmsg
    controls what message is sent back to the client if an error includes while parsing the document. When an error occurs, it is logged in the server's error log.

    <!--#config errmsg="[This directive failed miserably!]"-->
    <!--#include file="does_not_exist.txt"-->

    Result: [This directive failed miserably!]

    sizefmt
    determines the formatting to be used when displaying the size of a file. Valid choices are bytes, for a formatted byte count (formatted as 1,234,567), or abbrev for an abbreviated version displaying the number of kilobytes or megabytes the file occupies.

    <!--#config sizefmt="bytes"-->

    [an error occurred while processing this directive]