Including Files

One of the really cool things that you can do with SSI is include external files into a web page. This is the thing that SSI is really good at, and it is very simple and straightforward. The work you can potentially save is incredible.

The concept is simple. You have a web site which has similar information on each page. Let's say you have a menu down the left side of the page and a copyright notice at the bottom. In standard HTML, you must code all of these things on each and every page. This means that in order to make a change, you must physically edit all of the pages.

Using an SSI directive called "include" you can eliminate all of this work. You specify an "include" as follows:

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

You can include just about any type of file, including txt, htm, html or even shtml. In fact, you must be very careful not to include an shtml file which includes itself - you might put the server into an infinite loop. This makes web hosts very unhappy.

If the file is somewhere within your own virtual directory, you can specify the "include virtual" statement. An example is shown below.

<!--#include virtual "/myfile.htm" -->

This produces the same result as the above "include file". The different is the path of the file is fully specified.


Error processing SSI file


That's about how difficult it is to use SSI to include common information on web pages.

Internet Tips Contents
404 Errors Advertising Autoresponse Awardmaster Basics Browsers Careers Chatting Disasters Domains Email Emoticons Ezines Free Stuff Fun Stuff FTP Graphics Homepages HTML Reference HTML Tutorial Interactive Legal Links Msg Boards Microsoft Money Multimedia Networks Newsgroups Newsletter Products RFC's Ringmaster Searches Security Sticky Sites Surfing TANSTAAFL Telnet Viral Webmaster Your System