Sambar Server Documentation
|
Server-side Includes |
Using Server-side includes you can offer dynamically generated data such as the current date or time, include the output of a CGI script in a Web page, or signature files that are appended or prepended to all of your Web pages. All this comes with the cost of additional processing on the server to parse for the SSI directives within the HTML file. For this reason, you must configure the Sambar Server with the file extension that should be processed for Server-side includes; by default, the SSI files must have the extension .shtml. See the Configuration documentation for additional details on configuring or disallowing SSIs.
Server-side includes (SSI) can be configured so that users can execute arbitrary programs on the server (see the #exec command). The Sambar Server allows you to disable the #exec functionality from SSIs or disable SSI functionality all-together by removing the shtml entry from the Server Side Includes = line in the config.ini. This
Warning! Additional SSI extensions can be configured in the config.ini file, but the extension .stm should NOT added as an SSI extension; the .stm extension should only be used for Sambar Server scripting (required for the System administration pages).
where #command is the include command to be executed (see below for a list of supported commands). The following illustrates how to display when the current document was last modified:
include
include will insert the text of a document into the parsed document. This command accepts the following tag(s):
file
gives a pathname relative to the current
directory. ../ cannot be used in this pathname (this is not enforced by
the Sambar Server).
virtual
is a (%-encoded) URL relative to the
current document being parsed. The URL cannot contain a scheme or
hostname, only a path (a query string is not permitted). If
it does not begin with a slash (/) then it is taken to be relative to
the current document.
IMPORTANT! If the file does not begin with a slash (/), it is treated as a standard HTML file and sent uninterpreted.
If the file begins with a slash (/), then the included file may be any valid URL (i.e. HTML file, Sambar Server template, shtml file; or even CGI/WinCGI command). It is recommended that all include files have a leading slash (/) and avoid using relative paths.
echo
prints the value of one of the include
variables (defined below). All dates are printed in the standard
Sambar Server date format. The only valid tag to this
command is var
, whose value is the name of the variable
you wish to echo. See the ENV variables
sample server-side include form for echo
examples.
set
sets the value of a variable. The variable can be
used for substitution in exec
and include
directives.
To echo the value of a variable previously set, the variable must be pre-pended with a $ symbol:
exec
executes a given CGI or WinCGI script.
Valid tags are:
cgi
will execute the CGI script specified by the value.
By default, the CGI must be found in the cgi-bin directory and
the cgi-win directory will be set to the "working" directory.
wincgi
will execute the WinCGI script specified by the value.
By default, the WinCGI must be found in the cgi-win directory and
the cgi-win directory will be set to the "working" directory.
Note: CGI and WinCGI applications can be executed in the current document's directory (and will have a "working" directory of the document's directory) by pre-pending a dot-slash (./) in front of the executable.
cmd
will execute the Windows command specified by the value.
The working directory is the Sambar Server installation directory.
By default the PATH_INFO and QUERY_STRING of the original request are passed to the cgi/wincgi executable. The specification requires that all parameters to be passed to the CGI script be passed as arguments to the server-side include URL request. The Sambar Server extends this functionality, allowing parameter arguments to be provided to the CGI in the server-side include (see below). Any arguments provided for the CGI will be passed in the QUERY_STRING, over-riding the arguments passed to the original URL.
DOCUMENT_NAME
: The current filename.
DOCUMENT_URI
: The virtual path to this document
(such as /foo/zippy.shtml).
DATE_LOCAL
: The current date, local time zone.
DATE_GMT
: Same as DATE_LOCAL but in Greenwich mean
time.
LAST_MODIFIED
: The last modification date of the
current document in GMT.
LAST_MODDATE
: The last modification date of the
current document in local time.
config
printenv
fsize
flastmod
if / else / elif
constructs
© 1998 Sambar Technologies. All rights reserved. Terms of Use.