home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

13.2. Basic SSI Directives

All SSI directives have the format:

<!--#command parameter="value" ... -->

Each of the symbols is important; be careful not to forget the pound sign (#) or the dual dashes (--). Also, it is recommended that you place whitespace between the final arguments and the closing dashes to prevent it from being interpreted as part of an SSI argument.

Following is a list of the primary server-side directives, the parameters they take, and their function.

echo

echo encoding="type" var="environment_variable"

Inserts value of special SSI variables, as well as other CGI environment variables. For example:

<H1>Welcome to my server at <!--#echo var="SERVER_NAME" 
-->...</H1>

Arguments

encoding
Optional. This option is available in Apache 1.3.2 and later. It specifies how special characters contained in the variable are parsed before being output. none means no encoding is performed. url performs URL-style encoding. entity is the default value, which performs simple entity encoding. The encoding parameter must come before the var parameter, and is only in effect within the current echo directive.

exec

exec cmd|cgi="string"

Executes external programs and inserts output in the current document.

Arguments

cmd
Any application on the host.

cgi
A CGI program.

For example:

<!--#exec cmd="/bin/finger $REMOTE_USER@$REMOTE_HOST"-->
This page has been accessed 
<!--#exec cgi="/cgi-bin/counter.pl"--> 
times.
fsize

fsize file|virtual="path"

Inserts the size of a specified file.

Arguments

file
Pathname relative to a document on the server.

virtual
Virtual path to a document on the server.

For example:

The size of the file is
<!--#fsize file="/mybook.ps"--> bytes.
<!--#fsize virtual="/personal/mydata.txt"-->
include

include file|virtual="path"

Inserts text of document into current file.

Arguments

file
Pathname relative to a document on the server.

virtual
Virtual path to a document on the server.

For example:

<!--#include file="stuff.html" -->
<!--#include virtual="/personal/stuff.html"-->
printenv

printenv

Prints all environment variables on the server.

For example:

<!--#printenv-->


Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.