Online Manual

SSI

One of the most powerful and most neglected technologies available on the internet is called SSI, which stands for Server Side Includes. This neatly solves the problem of adding dynamic information to more or less static web pages.

How does this work? Well, when you surf to a web site, your browser is actually communicating with one or more computer systems called servers. The browser is called the client and the server is called, well, the server. On most web sites, the servers job is simple: when the browser asks for a web page, simply send it without any special considerations.

SSI is a method to ask the server to perform some work before handing off a page to the browser. A simple example is an SSI request to insert the date and time. This causes the server to replace the SSI command with the current date and time. This is all done by the server before anything is handed back to the browser - the only thing your browser sees is standard HTML code.

Enabling SSI

So how do you use SSI?
SSI files are slightly different from your standard HTML files.

To use SSI you must give the file a type of shtml (something like ssitest.shtml would do fine). Well, actually, with access to your .htaccess file, you can change HTML and HTM files to do the same thing, but that's a bit advanced for this article. Email support for help.

Once your file type is *.shtml, then your SSI commands will work. Now what do you do?

SSI Directives

An SSI directive (something which tells the SSI system what to do) is actually contained within a comment. Why? This way if you load the page onto a host which does not understand SSI, then the comment will simply be ignored - your pages will still work (except for the SSI commands, of course).

A comment takes the form:

<!--comment -->

An SSI command is a special form of the comment, as shown below.

<!--#directive -->

The pound sign tells the SSI enabled server that the "directive" following is an SSI command.

Some Examples

Okay, so now what? You start inserting SSI directives in your SHTML pages. You want to see what they look like? Here's some examples.

SSI Directive What? Result
<!--#echo var="DATE_LOCAL" --> Date and time Friday, 29-Mar-2024 01:01:11 EDT
<!--#echo var="REMOTE_ADDR" --> Your IP address 34.201.173.244
<!--#echo var="DOCUMENT_NAME" --> This file name ssi.htm

The "echo" directive tells the SSI enabled server to display (or echo) the following thing. In these cases, they are the date and time, your IP address and the document name. 

If you happen to look at the source for this table, you will see that the SSI directives have disappeared! They have been replaced, on the server, with the result of the directives. That's what makes SSI so powerful - all of the work is done on the server.

Additional Reading

 

Return To Menu

- Last modified on 3/16/2003 -


Home / Hosting / Domain Lookup / Support / Email Contact

© 1998-2024 Spunkyworld Internet Services - All rights reserved