Categories:
 

 

Partners
Save big on iPage's shared and Wordpress hosting with our March coupons!
iPage March coupons
Save big on iPage's shared and Wordpress hosting with our March coupons!
iPage March coupons
Facebook Fan Page


 

 

Pardon my language, but that's the exact phrase many people use when asked of this question. Allow me to explain. SSI stands for Server Side Includes, and are HTML commands that work like macros. Uh? In English, it means the use of the server to dynamically include something into a document. SSI is server-dependent, and is supported even by NS 2 (in other words, virtually all browsers on the net).

SSI works like this- You include inside your document a code fragment that looks something like this:

<!--#include file="afile.htm" -->

Servers that support SSI will not merely read the above as a HTML comment, but as a command that informs the server to insert "afile.htm" at that location of the document. The biggest difference in terms of syntax between a SSI code and a HTML comment is that SSI codes have a hash # following the tag opener.

Your server must support SSI in order to be able to take advantage of SSI commands. So how do you know if your server supports SSI? Well, first of all, most "free" web hosts, such as Geocities, Tripod, etc, do NOT support SSI...a rare exception is Hypermart. If your site's on a paid server, then this information should have been made available to you when you first signed on. If not, just send an email to your system administrator. Secondly, even if your server does support SSI, it's important to realize that most of them requires that you rename any HTML document that contains SSI from .html or .htm to .shtml. By doing so, the server knows that it should scan for and interpret SSI commands (instead of simply treating them as another HTML comment). Ok, now we're ready to officially see how to use SSI to dynamically embed a document inside another.

Red_CurlyC035.gif (995 bytes) Using SSI to embed a document inside another

You've already seen briefly how this is done, in the example shown on the previous page. Now, I will go into it detail. To include a document using SSI, use either one of the below two commands:

<!--#include file="external.htm"-->

<!--#include virtual="/external.htm"-->

Which one to use depends on where "external.htm" is located at. The first command assumes that the file is located in the same directory as the document containing it (relative reference); the second is an absolute reference to "external.htm", and simply looks for it at the path beginning at the root of server directories.

All the "Free JavaScript" pages on JavaScript Kit uses SSI to dynamically embed a footnote document at the end of the document. Here is an example. First, notice how the document has an extension of .shtml The last part of the document, including the copyright notice, is actually an external HTML file (footnote.htm) that is dynamically added to each and every Free JavaScripts page upon loading. The code I used to accomplish this is:

<!--#include virtual="/fotenote.htm"-->

Red_CurlyC035.gif (995 bytes) Other uses of SSI

SSI has many other uses, such as dynamically inserting the date, last modified date of a document, execute a unix command etc. If you're interested in learning more about these uses, a good place to start would be here.

.
End of Tutorial

http://www.javascriptkit.com
CopyRight 1997, 1998 JavaScript Kit. NO PART may be reproduced without author's permission.