Using Server Side Include Files
page 1 of 4
Published: 25 Sep 2000
Unedited - Community Contributed
Server Side Include Files provide a simple way to reuse code in ASP applications. In this article, you will see how to implement them and when it's a good idea to use them.
by Steven Smith
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 27984/ 64

Include Files

Server Side Includes (SSI) are a powerful tool for code re-use and to make site maintenance easier.  Include files can themsevles include other files, allowing for cascading include files. This can make it much easier for the developer to maintain a consistent site. One of the most popular uses for SSIs is to create uniform headers and footers, often with menu items. On a previous version of, I had both a standard header and a standard footer, which were referenced from one include file, called articleformat.asp.

Whenever possible, you should avoid simply including files inline in your ASP code. The reason for this is that if any variables are defined or changed in the included file, your ASP page may bomb due to a duplicate declaration or behave unexpectedly with the new variable's value. By using functions for all of your include files, you can place all of your includes at the top of your ASP file, where you can quickly see which files any given page depends on. Variables within the function are of local scope, so there is no need to use hacks like making up strange variable names in order to avoid name conflicts. Wherever you want to use the include file, you simply add a line of code invoking the function. For many of my library functions, I name the include file the same as the function to make it easy to tell which functions are in which files and what they're called.

View Entire Article

User Comments

Title: f   
Name: f
Date: 2012-09-16 8:44:59 PM
Title: Trainer   
Name: Prajakta
Date: 2009-03-13 1:29:47 AM
What is the disadvantage of include files over user controls?
Title: GUD   
Name: Raj
Date: 2005-12-12 4:54:20 AM
ya very nice ya

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-05-24 10:36:25 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search