LexiConn Knowledgebase

Knowledgebase Home | Favorites Knowledgebase Home | Favorites
Search the Knowledgebase Browse by Category
What are Server Side Includes (SSI)?
Article Details

Last Updated
17th of September, 2008

User Opinions (16 votes)
81% thumbs up 18% thumbs down

How would you rate this answer?
Not helpful

Server Side Includes (SSI) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or some other dynamic technology.

The decision of when to use SSI, and when to have your page generated completely by some program, is usually a matter of how much of the page is static, and how much needs to be recalculated every time the page is served.

SSI lets you embed a number of special 'commands' into the HTML itself. When the server reads an SSI document, it looks for these commands and performs the necessary action. For example, there is an SSI command that inserts the document's last modification time. When the server reads a file with this command, it replaces the command with the appropriate time.

By default, a file containing server-side includes must have a .shtml or .shtm file extension; however, if you need to process server-side includes in pages with an .html or .htm file extension, email us at support@lexiconn.com and we can enable it on your account.

One common use of server-side includes would be to implement a consistent site menu that can be included in every page on your site and updated by editing just one file. This can be done by creating an HTML file with your menu include (we'll assume you save it as menu.shtml), like this:

<div id="my_menu">
		<li><a href="#">Link 1</a></li>
		<li><a href="#">Link 2</a></li>
		<li><a href="#">Link 3</a></li>
		<li><a href="#">Link 4</a></li>
		<li><a href="#">Link 5</a></li>

Then, you would include this HTML fragment in each of your pages by placing the following SSI call where you want your menu to appear:

<!--#include virtual="[path-to-include]/menu.shtml"-->

Any updates to the menu.shtml file would be reflected in all pages containing this include.

For a list of other server-side includes, please visit:

Related Articles
No attachments were found.

Powered by Interspire Knowledge Manager Knowledgebase Software