1 Server Side Includes Compiler
2 =============================
4 This is ssic, a Server Side Includes Compiler.
6 ssic processes HTML documents with SSI directives formatted as SGML
7 comments. It can be used to process documents without an HTTP server
8 for local browsing or to generate static HTML documents to be
9 efficiently served by an HTTP server. Documents could even be
10 preprocessed, e.g. by a Markdown processor, before being parsed with
13 The set of commands, tags, and variables supported by ssic is mostly a
14 superset of those supported by the old NCSA HTTPd and a subset of those
15 supported by Apache HTTPd's `mod_include`:
17 http://web.archive.org/web/19971210170837/http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html
18 http://httpd.apache.org/docs/2.2/mod/mod_include.html
20 ssic uses the `CGI::SSI` Perl module for directive processing.
25 SSI directives are formatted as follows:
27 <!--#command tag1="value1" tag2="value2" -->
29 Most commands take only one tag.
31 The following commands are supported:
33 * `config` controls various aspects of processing. There are three
35 - `errmsg` controls the message that is substituted into the
36 document when an error occurs.
37 - `timefmt` is a format string used by `strftime` that controls the
39 - `sizefmt` controls the units of file sizes. Valid values are
40 `bytes` for sizes in bytes and `abbrev` for sizes in kibibytes or
42 * `set` sets the value of a variable. Two tags are accepted: `var`
44 * `echo` prints the value of an include variable (see below) or
45 environment variable. The only valid tag is `var`.
46 * `printenv` prints a list of all environment variables and their
48 * `include` processes and inserts the text of a document into the
49 current document. There are two valid tags:
50 - `file` gives a pathname relative to the current directory.
51 - `virtual` gives a pathname, beginning with `/`, relative to the
53 * `exec` executes a shell command. The only valid tag is `cmd`.
54 * `flastmod` prints the modification date of a specified file. Valid
55 tags are the same as for the `include` command.
56 * `fsize` prints the size of a specified file. Valid tags are the
57 same as for the `include` command.
62 The following variables are set:
64 * `__SSIC__` indicates that the Server Side Includes Compiler is being
65 used to process the document's SSI directives.
66 * `DATE_GMT` is the current date in UTC.
67 * `DATE_LOCAL` is the current date in the local timezone.
68 * `DOCUMENT_NAME` is the current filename.
69 * `DOCUMENT_ROOT` is the document root, in which files specified with
70 the `virtual` tag are found.
71 * `DOCUMENT_URI` is the current filename.
72 * `LAST_MODIFIED` is the modification date of the current document.
77 The flow control commands are:
79 <!--#if expr="test_expression" -->
80 <!--#elif expr="test_expression" -->
84 If `test_expression` evaluates to false, processing of basic commands is
85 suspended until the next `elif`, `else`, or `endif` is encountered. If
86 `test_expression` evaluates to true, processing of basic commands is
87 suspended between any following `elif` or `else` commands and the next
90 `test_expression` is a Perl expression, which is passed to Perl's
91 `eval()` function. Variables may be expanded but should be quoted.
93 The following example will output "foo is bar" if the variable `foo` is
94 set to the value "bar":
96 <!--#if expr="'$foo' eq 'bar'" -->
100 The following example checks the SSI interpreter and uses the correct
101 expression syntax for either ssic or Apache HTTPd 2.2 `mod_include`:
103 <!--#if expr="'$__SSIC__' eq '__SSIC__'" -->
104 <!-- Apache HTTPd 2.2 mod_include -->
105 <!--#if expr="$foo = 'bar'" -->
109 <!-- Server Side Includes Compiler -->
110 <!--#if expr="'$foo' eq 'bar'" -->
115 This is the recommended way to check the value of the variable
119 Copyright Information
120 =====================
122 Copyright (C) 2013 Patrick "P. J." McDermott
124 Copying and distribution of this file, with or without modification,
125 are permitted in any medium without royalty provided the copyright
126 notice and this notice are preserved. This file is offered as-is,
127 without any warranty.