Home / code / html

Server Side Includes.

Building a site is easier then maintaining it. If your site is larger then 50 pages, its a real task if you have to change the title or the company logo.

Server Side Includes - called SSIs for short - are a server technology that lets you build your Web pages through a series of reusable components.

The code:

<!--#include virtual="other_page.htm" -->
The cool thing about this is, that the SSi statement doesn't appear on the resulting webpage. It looks like it is 1 file.

Probably the most common use of SSI is to automatically post the current date and time. Just insert the code <!--#echo var="DATE_LOCAL" --> where you want the date and time to appear and the server will take care of the rest. By tweaking this code a bit you can change the way the date and time are presented.

Like CGI, ASP and PHP, there has to be some special server configuration. Also for this reason the extention of the file is *.shtml instead of html or htm. But this can be changed.

If SSI is not installed on your server, but other server side languages like asp, cgi, php... are; then you can use *.inc files. that does exactly the same.

We used to be warned about the extra load this placed on the server, slowing delivery of the pages. However, today's processing speeds seem to have eliminated this problem. If you're not getting hundreds of visitors per minute, don't worry about it.

There are several different ways that SSIs are implemented, depending on the configuration of your site's hosting server. The code I've quoted in this article works as described on my host's Linux/Apache server. Some servers may require you to use the .ssi suffix on the SSI page itself, or have other quirks. Contact your web host to get their requirements.



Latest script: