Scripting:
Guide to Server Side Includes (SSI) :
Server Side Includes (SSI) FAQ
This document is intended to teach you the ins and
outs of Server Side Includes and how to use them
on our servers. A general understanding of HTML is
required.
What In The World Are Server Side Includes ?
Server Side Includes are a special set of commands
that you can use inside HTML code when creating your
website. They let you easily add dynamic elements
to your pages such as the current date and time,
last modified date, and a users IP address and browser
type. Perhaps the most valuable use for SSI is the
ability to include external HTML documents within
your page.
SSI Basics (Using Server Side Includes)
In order to use SSI you must give your html files
a .shtml extension instead of the regular .html or
.htm extension. This tells our servers that you have
SSI commands within your pages so we can handle them
properly.
Once you have given your file
a .shtml extension you can begin to use SSI commands.
These commands are placed between special comment
tags within your HTML code. A typical SSI command
looks like this: <!--#command=""--> Remember
that what your code looks like will be different
from what is displayed on screen.
Does this seem confusing? Here is a list of SSI
commands and what they look like on screen. You can
simply copy and paste the command from here if you
wish.
Browser Output (on screen)
SSI Command Code
The Current Date and Time:
Thursday, 08-Apr-2004 12:03:31 EDT The Current Date
and Time:
<!--#echo var="DATE_LOCAL" -->
The Previous Web Page:
http://www.jinfo.net/support The Previous Web Page:
<!--#echo var="HTTP_REFERER" -->
Your IP Address:
80.137.99.6 Your IP Address:
<!--#echo var="REMOTE_ADDR" -->
Your Browser Type and OS:
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) Your
Browser Type and OS:
<!--#echo var="HTTP_USER_AGENT" -->
This Web Page File Name:
ssifaq.shtml This Web Page File Name:
<!--#echo var="DOCUMENT_NAME" -->
This Web Page File Size:
11K This Web Page File Size:
<!--#fsize file="ssifaq.shtml" -->
This Web Page Last Modified Date:
Wednesday, 03-Jan-2001 15:03:11 EST This Web Page
Last Modified Date:
<!--#flastmod file="ssifaq.shtml" -->
Lets Make A Date!
You can customize your date any way you please.
This is accomplished by placing a special time format
command directly in front of the Current Date and
Time command that we looked at above. Lets take a
look at a few examples:
If you want your date to look like this: Thu 08
Apr 04
<!--#config timefmt="%a %d %b %y" -->
<!--#echo var="DATE_LOCAL" -->
If you want your date to look like this: Thursday
April 08 2004
<!--#config timefmt="%A %B %d %Y" -->
<!--#echo var="DATE_LOCAL" -->
If you want your date to look like this: 04/08/04
<!--#config timefmt="%m/%d/%y" -->
<!--#echo var="DATE_LOCAL" -->
Here is the entire list of Time Format codes:
Full Name Abbreviated Name
%A Full weekday name %a Abbreviated weekday name
%B Full month name %b Abbreviated month name
%Y Full year %y Abbreviated year
%D Date as mm/dd/yy %d Day of the month
%H Hour as 1 - 23 %I Hour as 1 - 12
%M Minutes 0 -60 %m Month of the year 01 - 12
%R Time as %H: %M %r Time as %I: %M: %S: %p
%p a.m. or p.m. %T Time as %H: %M: %S
%S Seconds as 0 - 60 %Z Time zone name
SSI Troubleshooting
Q - I have placed an SSI command within my HTML
file but nothing happens.
A - Make sure the extension of your HTML file .shtml
and not .html or .htm
Q - I keep getting the following error: [an error
occurred while processing this directive
A - If you are trying to include a file make sure
it is in the same directory as the main file. Also
make sure you have spelled the filename correctly
in your SSI command.
Q - Why can't I execute CGI (perl) scripts within
my webpage using the #exec cgi command?
A - At this point Jinfo does not provide #exec-cgi
functionality - although you can still use scripts
from your CGI-BIN directory.
|