Server Side Includes (SSI) provide another means to generate
dynamic HTML. Special tags in the HTML files cause the server
to replace the tag with alternative data (such as the contents
of another file) when the file is served.
Server Side Includes are useful for including a common piece
of code throughout a site, such as a page header, a page
footer or a navigation menu. If the common code is modified,
all pages display the new code. This is preferable to having
to modify every page.
SSI has a simple syntax:
<!--#directive parameter=value parameter=value -->
Directives are contained within HTML comments so that if SSI
is not enabled, users will not see the SSI directives on the
page, unless they look at its source.
Note that the syntax does not allow spaces anywhere between
the leading "<" and the directive. The tag must begin with
the exact sequence "<!--#" and end with the sequence "-->" otherwise it won't be recognised. Spaces are allowed (and are desirable) between the end of the directive and the "-->".
The SSI directives currently accepted (v501b) are as follows:
Directive Parameter Parameter value
~~~~~~~~~ ~~~~~~~~~ ~~~~~~~~~~~~~~~
ECHO VAR DATE_LOCAL
ECHO VAR LAST_MODIFIED
ECHO VAR NODE_CALL
ECHO VAR NODE_ALIAS
ECHO VAR NODE_QTH
EXEC CMD {any XRPi cmd string}
FLASTMOD FILE {relative filename}
FSIZE FILE {relative filename
INCLUDE FILE {any file under current dir}
INCLUDE VIRTUAL {any file within http tree}
ECHO displays the contents of a specified HTTP environment
variable. Variables include DATE_LOCAL which displays the
local date and time, and LAST_MODIFIED which displays the
modification date and time of the HTML file that is being
served. The remaining variables, i.e. NODE_CALL, NODE_ALIAS
and NODE_QTH are non-standard XRPi-specific ones.
Example:
<!--#ECHO VAR=DATE_LOCAL -->
EXEC executes a command. The CMD parameter specifies that the
parameter value contains an XRPi command, and the parameter
value specifies the command and any argument(s). If the
command has arguments, the string should be enclosed in
quotes. Not all commands are allowed, only those which are
non-interactive and normally available to users. The results
of the execution are displayed to the user. If the response
contains tables, the whole directive should be enclosed in
<PRE></PRE> tags to preserve the formatting. For example:
<PRE><!--#EXEC CMD="r r" --></PRE>
FLASTMOD and FSIZE display the date when the specified
document was last modified, or the specified document's size.
The FILE or VIRTUAL parameters specify the document to use.
The FILE parameter defines the document as relative to the
current document path; the VIRTUAL parameter defines the
document as relative to the HTTP root.
Example:
<!--#FSIZE FILE=myfile.txt -->
INCLUDE allows the content of one document to be included in
another. The file or virtual parameters specify the file
(HTML page, text file, script, etc.) to be included. The FILE
parameter defines the included file as relative to the current
document path; the VIRTUAL parameter defines the included file
as relative to the HTTP root.
Example:
<!--#INCLUDE VIRTUAL=/bbs/msglist.txt -->
If the included file also contains Server Side Includes, they
will not be actioned.
Some servers will not execute SSI unless the HTML file has a
.SHTML, .SHTM or .STM extension. XRPi does not require this.
SSI cannot be used in EXEC.HTM at present.
The file "menu.htm" contains several examples of how to use SSI. You may use it as-is, or modify it to your own requirements.