|
| Introduction to SSI |
As introduced in the Building Section, SSI Commands are commands that you write as part of your HTML page. Thye are not displayed "as is." Before your page is sent, the web server processes the page and executes any SSI commands on your page, replacing the commands with the information the command specifies. |
|
How do you write an
SSI Command?
|
SSI Commands are written within an HTML "comment" statement. Comments are ignored by browsers in a received page.
Since the web server "processes" an SSI page before it is sent, replacing the SSI commands with real information, the SSI command (in a comment) is never seen by the browser. |
An HTML Comment
<!--Anything here is an HTML comment-->
An SSI Command within an HTML comment
<!--#command tag="some value"-->
|
|
Why don't my SSI
commands work? |
Remember, if your web page contains SSI commands, you MUST name your page with the ".ssi" or ".shtml" extension, otherwise, the page will not be processed and your SSI commands won't work. |
|
| SSI COMMAND REFERENCE TABLE |
| Command |
Tag |
Values |
Examples |
config
Configure format for
displaying the time and
file size. Also used to
customize the SSI error
message, or change
character translation,
or generate a new
random number. |
errmsg |
your own wording |
<!--#config errmsg="An SSI error occured"-> |
| timefmt |
timefield descriptor |
<!--#config timefrnt="%B %D %Y"--> |
| sizefmt |
bytes, abbrev |
<!--#config sizefmt="abbrev"--> |
| charset |
normal, latin1, ascii |
<!--#config charset="latin1"--> |
| newrandom |
integer between 2 and 10,000 inclusive |
<!--#config newrandom="500"--> |
|
counter
|
var |
name of counter |
<!--#counter var= "my.pagecounter"--> |
The counter command
increments a counter
variable, and inserts
the new value into the
HTML output stream. |
display |
true, false, off, on, yes, no |
<!--#counter display="off"--> |
|
echo
Echo an environment or
WebSTAR API variable. |
var |
environmental variable |
<!--#echo var="HTTP_USER_AGENT"--> |
|
flastmod
A files last modification date |
virtual |
file path to local URL |
<!--#flastmod virtual="/stuff/afilename.html"--> |
|
fsize
A files size in bytes or kilobytes |
virtual |
file path to local URL |
<!-~#fsize virtual="/stuff/afilename.htm1"~-> |
|
hide
To conditionally turn off the HTML output stream based upon environmental variables, operators and values. |
none required |
defaults to "=" |
<!--#hide--> |
| operator |
contains, start, end, =, ==, !=, <>, <=, =<,>, >=, =>
(see operators below) |
<!--#hide variable="date_gmt" operator="contains" value="2001"--> |
| value |
optional (defaults to empty string) |
| variable |
(see Environmental variables below) |
<!--#hide variable="date_gmt"--> |
|
include
Include another
document into the
HTML output stream. |
virtual |
file path to local URL |
<!--#include virtual="/stuff/afilename.txt"--> |
|
postarg
Display named
variables that have
been sent to an SSI
page from an HTML
form. |
var |
name of form variable from the page |
Hello. <!--#postarg var="your_name"--> |
|
show
To conditionally turn
on the HTML output
stream based upon
environmental
variables, operators
and values. |
none required |
defaults to |
<!--# show--> |
| operator |
contains, start, end, =, ==, !=, <>, <=, =<,>, >=, =>
(see operators below) |
<!--#show variab1e="date_gmt" operator="contains" value="2001"--> |
| value |
optional (defaults to empty string) |
| variable |
(see Environmental variables below) |
<!--#show variable="date_gmt"--> |
|
store
|
variable |
your variable name (up to 33 characters) |
<!--#store sp_offer="Upgrade for only $299!"---> |
Saves text or numbers
for later use by the
echo, name, hide, or
show commands. |
kind |
optional: local (default), shared or persist |
|
| SSI Environmental Variables |
| Parameter Name |
Description |
Sample Value |
| CONTENT_LENGTH |
Form posting info to SSI page: length of posted data |
1024 |
| CONTENT_TYPE |
Form posting info to SSI page:Type of information sent to server |
application/x-www-form urlencoded |
| DATE_GMT |
The current date/time, GMT |
2001/10/31:00:45:10 |
| DOCUMENT_NAME |
The document"s path and filename. |
hard drive:webstar:widgets:blue.html |
| DOCUMENT_URI |
The URL of the document |
/widgets/blue.html |
| GATEWAY_INTERFACE |
The CGl or APl version the server uses |
WebSTAR API (version 1) |
| HTTP_ACCEPT |
MIME Types browser can accept |
image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* |
| HTTP_REFERER |
The document the user just came from |
http://www.lorian.net/default.html |
| HTTP_USER_AGENT |
The name and version of the user's browser |
Mozilla/4.77 (Macintosh; I; PPC) |
| LAST_MODIFIED |
Date an dtime the document was last modified |
2001/10/21:11:29:07 |
| PATH_INFO |
Text of the path arguments, after the $ character in the URL |
sales%20territory |
| PATH_TRANSLATED |
Decoded path arguments, after the $ character in the URL |
sales territory |
| QUERY_STRING |
Text of the search arguments, after the $ character in the URL |
sample=region%201&name=pat |
QUERYSTRING_
UNESCAPED |
Decoded search arguments, after the $ character in the URL |
sample=region 1&name=tina |
| REMOTE_ADDR |
Clients lP address |
192.168.24.16 |
| REMOTE_HOST |
Client host name, if "use DNS" is turned on, otherwise, the IP address |
leslie.domain.com |
| REQUEST.METHOD |
The request method |
GET |
| SCRIPT NAME |
Path of the requested URL |
/cgi-bin/myscript.cgi |
| SERVER_NAME |
The server host name |
www.lorian.net |
| SERVER_PORT |
The port number used |
80 |
| SERVER_PROTOCOL |
The HTTP version used by the server |
HTTP/1.0 |
| SERVER_SOFTWARE |
Name and version of your serverss software. |
SERVER_SOFTWARE: WebSTAR/4 .0 ID/55512
|
|
| SSI Field Descriptors for TimeFmt |
| Field Descriptor |
Description |
Example |
| %a |
Abbreviated weekday name |
Mon |
| %A |
Full weekday name |
Monday |
| %b |
Abbreviated month name |
Jun |
| %B |
Full month name |
June |
| %c |
Date and time (like %A, %d %B%Y%l:%M:%S %P) |
Monday, 12 November, 2001 11:08:59 AM |
| %d |
Day of month from 01 through 31 |
05 |
| %H |
Hour in military time from 00 through 23 |
22 |
| &I |
Hour in civilian time from 00 through 12 |
10 |
| %j |
Day of year |
156 |
| %m |
Month from 01 through 12 |
06 |
| %M |
Minute from 00 through 59 |
21 |
| %p |
AM or PM |
PM |
| %S |
Seconds from 00 through 59 |
14 |
| %U |
Week number of year, beginning on Sunday |
23 |
| %w |
Day of week as a number (Sunday is day 0) |
0 |
| %W |
Week number of year, beginning on Monday |
22 |
| %x |
Date, in the form "Day Month, Year" (%d %B, %Y) |
12 November, 2001 |
| %X |
Time, using the HH:MM:SS format
(Hours:Minutes:Seconds) |
22:21:14 |
| %y |
Year in two digit format, from 00 through 99 |
01 |
| %Y |
Year in four digit format |
2001 |
| % % |
A Percent Sign (%) |
% |
| NOTE |
The following NCSA timefmt descriptors are not supported: |
%C, %D, %e, %h, %k, %l, %n, %r, %R, %s, %t, %Z |
|
FTP ACCESS |
|
CGI OPTIONS |
|