Using Server Side Include on web pages
Why SSI?
- SSI allows for a more manageable server. By forcing strict templating on all web pages, the content of the pages is seperated from the pretty interface. Changing the entire look and feel of the web site only requires changing a couple of files, instead of hundreds or thousands.
- SSI allows very primitive scripting within the web pages. This allows for conditional and dynamic web page creation.
- Since the server parses the documents before they are sent to the web browser, the client browser cannot tell the difference between server-parsed and regular html, guaranteeing compatibility.
Starting a new web page using SSI
- Find the appropriate SSI page template from
/Common/WebRoot/template/
. You can see the sample pages on the server here. - Choose a filename and directory appropriate to the topic of the page; be sure to use the '.html' ending to the filename. Use the .html ending for your new page's filename. Copy the template to this file.
- Edit the file. At the top is a line that looks like this:
<!--#set var="TITLE" value="YOUR TITLE HERE"-->Set the title of your page by replacing YOUR TITLE HERE with your title after the "value=". The title will show up both in the web page and on the top component bar of the web page.
- Begin the text of the page after the "YOUR TEXT BEGINS HERE" comment. End your text before the "YOUR TEXT ENDS HERE" comment.
Converting an existing, non-SSI page to SSI
- Remove the TCBG header information. Delete all HTML markup from the top of the page to the beginning of your content/data.
- Replace the deleted HTML with the appropriate header portion from the
SSI templates located in
/Common/WebRoot/template/
up to and including the "YOUR TEXT BEGINS HERE" comment. - Remove the TCBG footer information. Delete all HTML markup from the "CONTENT ENDS HERE" comment to the end of the file.
- Replace the deleted HTML with the appropriate footer portion from the
SSI templates located in
/Common/WebRoot/template/
. - Set your title as described above.
SSI Variables
You can set several variables in the first few lines of your HTML code that will affect how the page is laid out. Specifically:
- TITLE - this is the page title, and must be set on all pages. The title is put into the HTML headers, as well as listed on the top of each page for ease of navigation.
- SIDEBAR_URL - this is the URL of a page to load into the left
sidebar of the HTML. If set, it replaces the standard
"quicklinks" loaded by each style of research page. This is often
used when replacement navigation is desired.
Example: This page uses this SHTML:<!--#set var="SIDEBAR_URL" value="/Development/Computers/sidebar.html"--> - SIDEBAR - this variable offers some additional text and/or HTML in the sidebar. This extra code replaces the search bar; so, if you want a search bar too, you'll have to add it back in.