Hosting Plans Web Design Resellers Support Contact us Mainswitch Hosting
Home  |  Site Map

  About us

  Contact us

  Apply for Account

  Compare hosting plans

  Customer reviews

  Domain name registration

  Terms of service

Check Domain Availability

 

Register your domain name
for only 16 /year





24/7
Technical Support



  Support

 
Server Side Include (SSI) | Back to main FAQ page |

What is Server Side Include?
SSI syntax and server-parse
Executing a CGI script inside HTML
Print last file modification
Include named file contents



What is Server Side Include?

A server-side include (SSI) is an embedded code in your HTML page that instructs the web server to do something prior to loading the page in the visitor's browser. SSIs can be used to include text from other files, display the date and/or time, show when the page was last modified, execute shell commands and CGI scripts, and more.



SSI syntax and server-parse

The basic syntax for a SSI is as follows:

<!--#element attribute=value attribute=value-->

This code goes in your HTML page, wherever you want the results of the SSI to appear. The SSI needs to be server-parsed to work properly. If you want the HTML file to be server-parsed, simply name it with the extension ".shtml" instead of the conventional ".html". You only want to set your HTML file to be server-parsed if you actually plan to use SSIs within it. Un-needed ".shtml" files can slow down a website due to un-needed server-parsing.




Executing a CGI script inside HTML

To execute a CGI script using an SSI, the syntax is as follows:

<!--#exec cgi="yourfile.cgi"-->




Print last file modification

To print the last modification of a named file on your webspace, there are two ways to do it:

<!--#flastmod file="yourfile.html"--> Names the file in the same directory
<!--#flastmod virtual="/index.html"--> Names the file relative to the web root




Include Named File Contents

To include the contents of another named file into your current HTML, there are two ways to go do it:

<!--#include file="yourfile.html"--> Names the file in the same directory
<!--#include virtual="/index.html"--> Names the file relative to the web root




Copyright © 2002 Mainswitch Hosting Solution All Rights Reserved.

Terms and Conditions.