Web Standards Guide
The University of Adelaide Australia
Web Standards Home
Conditions of Use
Content style guide
Plan your site
Maintain your site
Using Server Side Includes
Using style sheets
Using headings
Using tables
Set up email address for enquiries
Upload your pages
Extend your site
Visual Identity [External link]
Contact us

Online Media Unit
Level 7, Old Classics Wing
THE UNIVERSITY OF ADELAIDE
SA 5005
AUSTRALIA
Email


Telephone:
+61 8 8303 3280
Facsimile:
+61 8 8303 4829

Using Server Side Includes

Server Side Includes are instructions to the server to include a specified HTML file within the current HTML document when it is displayed. Placing a SSI in a document inserts a reference to the external HTML file. Then when the page is displayed the reference to the file is replaced by the contents of that file. Any changes to the external file are automatically reflected in every document that includes it.

Why the templates use SSI

Server Side Includes simplify HTML code by allowing commonly used elements of a page to be placed in a separate file. This makes it easy to change key elements on a web site in one place, rather than having to make the same change on every single HTML page on the site.

For example, if your pages share a common banner, you can put the code for the banner in a separate HTML file and 'include' that banner on each of the pages that use it rather than hard coding it on each page. Any changes made to the banner are then automatically reflected in all pages that include it.

How to perform a SSI in a HTML file

A Server Side Include is entered in a HTML document as a comment referring to the HTML file to be included when the page is displayed.

A Server Side Include looks like:

<!--#include virtual="/foo/bar/blah.html" --> 
or
<!--#include virtual="foo.html" -->

When the page is served to a browser, the server will read all included files and insert them into the page in place of the reference before sending them to the browser.