ITD Home

A-Z Index

Web Services Links

Homepage

Contact Us

Our Services

General Information

Feedback Form

BNL Site Index

Need Help

Helpdesk Homepage Call the Helpdesk for 24x7 support
Bus: 631.344.5522
Fax: 631-344-2140
Email: itdhelp@bnl.gov

What are Server Side Includes?

Server Side Includes or SSI allow the use of shared common code such as headers, footers, and left navigation created in one file and shared through the use of "includes" throughout the site. The advantage is that only one file needs to be updated when a global change is made.

SSI can even be used when there are slight differences from page to page as it supports the use of conditional logic. For example, you can tell your SSI to include a link to your program's homepage in the footer except when you are on the home page.

Typically, sites that use SSI must use the ".asp" or ".shtml" file extension to let the server know that SSI is in use. ITD web servers (Windows Platform) are setup to only allow the use of SSI on all files with ".asp" or ".shtml, shtm" file extensions.

Server Side Includes and Performance Considerations - Why the .shtml extension is used If an html document contains "Server Side Includes" that means that it includes special commands for the Server to process. This is normally how things like counters are done on basic web pages.

On some websites, the webmaster sets up the server to parse, or read through every .html or .htm file to see if it contains server instructions. However, this WILL slow things down when people link to the pages.

So, many webmasters have instituted the .shtml files. This is simply a naming convention that says "This html file includes Server commands - please parse it before delivering to the browser site" (hence the "s"). That way parsing can be skipped for all "plain" .html [or .htm] files.

Syntax Examples

Standard Version (conventional):
<!-- #Include File="../includes/leftnavbar.inc" -->

FrontPage Version (using FrontPage Extensions):
<!--webbot bot="Include" U-Include="includes/leftnavbar.htm" TAG="BODY" -->

Guidelines

Apache's Web site includes an excellent SSI tutorial: Introduction to Server Side Includes. For more resources on SSI, check out the Web Developer's Virtual Library.

  • General Includes should be stored in a common "/includes/" directory.
  • Best Practices, use SSI for these elements of your site:
        - Header
        - Left Navigation Bar
        - Search Box (if not included in the Left Navigation Bar)
        - Footer

If you have a question that is not addressed in these pages, please send an email to itdhelp@bnl.gov.

 

Top of Page

Last Modified: February 1, 2008