Server Side Includes
A Server Side Include (SSI) is a command or directive in your HTML file which tells the server to dynamically insert some data into your page. With a simple SSI command you can update an entire site design, dynamically add the current time and date or the date a file was last modified, include HTML from other files and more.
You code SSIs through the use of a comment line. The basic format for SSI is
<!--#command tag="value" -->
where #command can be any of various commands supported by the web server.
There is no official standard for SSIs, so every Web server is free to support different SSI commands in different manners. However, many SSI commands, such as #include and #echo, have become de facto standards. In addition to the possibility of differences from one web server to another, the systems administrator must configure the web server to allow the use of SSI in your web pages.
At RootsWeb, the two most commonly used SSI commands are available for your use: #include and #echo. Also, you may use the #config command to tailor the appearance of the output from the #include and #echo commands.
Because the SSI command is interpreted and executed by the web server, the command itself is not seen at the browser. Rather, the web page winds up with dynamically generated content which is not dependent on the type of browser in use by the visitor. All processing is done on the server side and the result is displayed as plain HTML.
SSIs have a variety of applications. You can create documents which provide dynamically generated information such as today's date, the date that the page was last modified, and the size or last modification date of other files.
Another application of SSIs is to provide identity and consistency to a site. This can be accomplished by creating document templates and including repetitious pieces of information in them dynamically from SSI-included files. For example:
- Page Headers. A header file can include a <BODY> tag in order to maintain a consistent set of background colours, text colours, and link colours. You can also include a set of navigational buttons on the top (or bottom if you wish) of every page of your site. Another option is including a CSS. With a change to this header file, all the pages at your site will pick up the changed appearance.
- Page Footers. You can include common informaton such as copyright, last modification date, author name and e-mail, a link to the home page of the site, and so on - at the bottom of every page of your site. Again, by putting this information into a single trailer file, you can update all the pages at your site with a single change. Think how helpful this would be if your e-mail address was to change.
Using SSI can help you organize your site by having these repetitious pieces of information stored in a file which is then included in your web pages. You can use a file extension other than .html or .htm to help you remember that these files are not complete pages by themselves. Using file extensions as a key to a file content can help you keep better track of your files.
Last modified Monday, July 22, 2002