GENUKI Maintainers' Pages

Version 2.0

Server Side Includes (SSI)

SSI (Server Side Includes) are directives that are placed in web pages, and evaluated on the server when the pages are being served to a browser. They allow the dynamic generation of content and its addition to an existing web page. They are sometimes called SHTML fragments because they are invoked by means of the shtml file extension. The main disadvantage is that web pages using SSI cannot be fully tested on a local computer because there is, effectively, no server to execute the SSI directives.

The most frequent use of SSI is to include the contents of one or more files into a web page on a web server. For example, the current service status message could be included in web pages by using:

By changing only the "currentservicestatus.txt" file, all pages which included the file will display the latest status.

Server Side Includes are also useful for including a common piece of HTML code throughout a site, such as a standard page header, a page footer or a navigation menu. Navigation menus can be conditionally included using control directives. SSI can also be exploited as a simple programming language.

For a web server to recognize an SSI-enabled HTML file and therefore execute the SSI directives, the web page's filename must have the extension shtml.

There are many others, but the following small selection of SSI directives might be useful to GENUKI maintainers:

Some examples of the use of SSI in a GENUKI context follow:

Remember, the page source that you see in your browser is that produced by SSI not the original with the special comments. An example of a page using the code fragments above is that of Lytham.

All these scripts use the url of the page in which they appear as a starting location by looking it up in the gazetteer, and if found using the location of that town/parish. If it isn't within a town parish/page they use the location specified as a GR= parameter (or LAT= & LON=) to determine the parish. So if you included it in test.shtml it would do the same job as if it was in the twon/parish page itself. The county code in the CCC= parameter is used to work out which map links are required as they vary from country to country.

The first two above include details from the church database into the page and the selection is for those entries containing the url of the SSI page, in this case Lytham.

piclinkssi and maplinkssi are just ssi versions of the piclink and maplink cgi scripts and produce the links within the SSI page itself.

[Last updated at 07.14 on Tuesday, 15 July 2014, by Mel Lockie. 2014]
Hosted by Mythic Beasts Ltd.