Demo of Apache Server Side Includes (SSI).

jim.cerny@unh.edu  03-JUN-1999


Preliminary.

To modularize some of your HTML code and to maintain flexibility in changing the format of your Web pages, a useful technique is to include other files. One technique is client side includes using JavaScript. That assumes the browsers used by your audience have suitable JavaScript support.

Another technique, demonstrated here, is the server side include, which makes no assumptions about the browser. UNHINFO uses the Apache server and there is documentation on using server side includes. The colored box at the bottom of this page is an HTML Table added with SSI. But you can't view source in your HTML browser to see the actual include statement(s) because that substitution takes place at the server side, before it gets to your browser. In this case there is one include for the box:

   <!--#include file="goforit.html" -->
The separate chunk of HTML code that gets included is in the file goforit.html.

Note that all the HTML in this document is under the influence of a Cascading Style Sheet -- for example that is what causes the text in the box to be blue. Check the style sheet.

Go For It!

Next.

Right now we have server side includes enabled for files with .html as well as .shtml file types, but we may review that and limit it to .shtml to reduce parsing overhead on the server. We have the "exec" element disabled.

Is there any reason NOT to use SSI? Only if there was the possibility that someday you would move your files to a Web server that did not support them. Most servers have such support, unless it is disabled as a sysadmin management decision.

There is much more that can be done with SSI and this document will be expanded in preparation for a workshop in August, 1999.