James H. Zisch - Computer Services

Support : Guides

 

SSI Commands

Config

Used to set the sizefmt and datefmt variables controlling output file sizes and dates.

Parameters:

datefmt = the date format
sizefmt = the size format

Syntax:

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

Cookie

Cookies access from server side includes.

Parameters:

get = name of the cookie to get
alt = alternative value
if = name of the cookie (just to test if the cookie exists)
then = value

Syntax:

<!--#cookie get="C1" alt="hello" -->,
display the value of the cookie "C1" or "hello" if the cookie
is not in the incoming request.

<!--#cookie if="C1" then="hello" alt="bye"-->,
display "hello" if the cookie "C1" is in the request. If not display "bye"

Count

This command inserts the number of recorded accesses to this resource, as reported by CounterFilter.

Parameters: none

Syntax:

<!--#hitcount -->

Echo

The echo SSI command. As extensions, it has the parameters "reqstate" (for echoing Jigsaw request states) and "reqheader" (for echoing request header).Also, it can take the flag "here", whose presence means that the variable is to be interpreted at the deepest request level (in the case of chained internal requests), instead of doing so at the top (external request) level. It inserts the value of a variable in the document.

Parameters:

var = a SSI variable
reqstate = a Jigsaw request state
reqheader = a request header
here = a flag

Syntax:

<!--#echo var="DOCUMENT_URI" -->
display the document uri

<!--#echo reqheader="referer" -->
display the referer header of the request

<!--#echo reqstate="pathinfo" -->
display the request state "pahtinfo"

Exec

The SSI exec command. It inserts the output from a CGI script or a shell command in the document. Note that in the Jigsaw architecture CGI scripts are just another resource class, so that no distinction is made between executing a CGI script or including a file.

Parameters:

cmd = the command to execute

Syntax:

<!--#exec cmd="ls -lsa" -->
display the result of the ls command

FLastMod

The standard lastmod SSI command.

Parameters: none

Syntax:

<!--#flastmod-->

FSize

The SSI fsize command. It inserts the size of the unparsed file in the document, according to the current value of the variable sizefmt.See configCommand.

Parameters: none

Syntax:

<!--#fsize -->

Include

The SSI include command. (CGI scripts can be included, simply by providing a so-called virtual path to a resource with a CgiFrame).

Parameters:

file = the file to include
virtual = a virtual path
ifheader = a request header
else = a file

Syntax:

<!--#include file="included.html" -->
include the file "included.html" in the current file

<!--#include ifheader="Referer" file="included.html" else="included2.html" -->
if the request has a Referer header then include "included.html"
else include "included2.html"

jdbc

The SSI jdbc command allows you to query a SQL database via JDBC. Combinated with some Control Commands, it allows you to display the content of a database easily.

Parameters:

select = the SQL request
url = the database URL
driver = the JDBC driver class
user = the username
password = the password
name = the result name
column = the column number
next = a flag

Syntax:

<!--#jdbc select="SELECT * FROM services" name="result"
driver="com.imaginary.sql.msql.MsqlDriver"
url="jdbc:msql://www43.inria.fr:4333/services" -->
this is the setup of the command.

<!--#jdbc name="result" next="true" -->
this command move the pointer to the next line of the result set.

<!--#jdbc name="result" column="1" -->
display the first column of the current line.

<!--#jdbc name="result" column="2" -->
display the second column of the current line.

<!--#jdbc name="result" column="3" -->
display the third column of the current line.

Servlet

The SSI servlet command. Servlet can be executed simply by providing a url path to a servlet class.

Parameters:

name = the command identifier
code = the servlet URL
param = a parameter name
value = a parameter value

Syntax:

<!--#servlet name="Snoop" param="p1" value="v1" -->
<!--#servlet name="Snoop" param="p2" value="v2" -->
<!--#servlet name="Snoop" param="p3" value="v3" -->
<!--#servlet name="Snoop" code="/servlet/snoop" -->