Sitemap

SSI Server Side Includes

*

What is SSI?

Your ISP server has information about visitors to your site from the referer URL included with your visitors file request. This is normally stored away in a log file. Most ISPs allow you to look at the log files. Note: Compuserve Ourworld, and some others do not allow this.

To test whether your server offers SSI you can put the following SSI command on a page on your website and if it just shows the Testing SSI: bit without any response you know it does not work for you.
Testing SSI: <!--#echo var="HTTP_USER_AGENT"-->

*Testing SSI:

Server Side Includes (SSI) are special commands which can be imbedded in your HTML code which tell the server that you would like some of this information on the display now.

What use is it?

What are you are going to do with this information? There is a count demo below which could be good. And a date last modified.

For the rest you can display the facts on the page that the visitor is accessing. Interesting but not very useful.

JavaScript, Java or Perl have similar facilities and can process the information if you have a suitable program to do this.

Some restrictions

Compuserve Ourworld, and some others do not allow access to SSI or CGI. On other servers you can try the technique with a simple command to see whether this works for you. Or ask the Help Desk for assistance.

Some servers require a specific filename extension for this to work. You will note that this page has a file name of ssi.html instead of the more usual .htm This is because the file uses SSI features, and these are only available on my server for .html files. Other servers may require .shtml extensions.

Pages tend to load rather slower with SSI commands as the server has to parse the page and find out what SSI commands are included, and then execute them.

You have to upload the file containing SSI commands to your server before you can test whether they work.

General Format

The commands are placed within comment markers
<!--comment-->
so that they shall not be visible to the surfers if for some reason they are not operational today.

Include SSI

SSI can be used to include a standard file in a page with a single short command. The format is
<!--#include file="text.txt"-->

*The Insert is:

I plan to use this technique to insert the boiler plate on the bottom of each of my pages. In this way I can keep just the one file of text up to date, and it will be automatically shown correctly everywhere.

Execute SSI

The hit-counter example accesses a CGI program, and is the same as the plain-number hit-counter on my entry homepage. The command is unique to the managers of my own server and is of the form
<!--#exec cgi="/counters/usercount"-->

*The hit counter now reads:

Echo SSI

Here is the Echo command with some of the available variations. There a stack of other codes which I have not found useful for my work. They are listed on the Bignosebird site (below)

The commands are all of the form
<!--#echo var="NAME"-->>
The NAME in each case is noted for your own use.

The most useful ones first:

*Page last modified LAST_MODIFIED

*The local time DATE_LOCAL is

*The GMT time DATE_GMT is

You can configure the date format: full details of all the available codes are on the Bignosebird site (below)

This requires a pair of commands, for example:
<!--#config timefmt="%d/%m/%Y - %T"-->
<!--#echo var="DATE_LOCAL"-->
*The local time DATE_LOCAL is

Facts from the access request packet:

*Remote user browser and version HTTP_USER_AGENT

*You asked for DOCUMENT_NAME

*Document URL DOCUMENT_URI (note the URI not URL)

*HTTP referer HTTP_REFERER

*Remote Address REMOTE_ADDR

*Remote Host REMOTE_HOST

*Remote User REMOTE_USER (normally does not show anything)

*Server Name SERVER_NAME

*Server Software SERVER_SOFTWARE

Information from the Server (format of the command may vary)

*Page Count PAGE_COUNT

*Total Hits TOTAL_HITS

*

A Credit to http://www.bignosebird.com for the ideas behind this page.

Also see the tutorial on http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html

[ Top ]

*

Website by: Richard Waller
Comments? Suggestions? Contributions?
Please contact us
      Go to HomePage Home
Page
     Go to Sitemap Site
Map

URL: http://www.waller.co.uk/ssi.htm