

|
 |
Server-Side Includes (SSI)
Server-Side Includes (SSI) are a feature of CGI, in conjunction with your server. They allow you to dynamically insert a piece of information like the date or a file, as well as
execute CGI/Perl scripts on your web page. The browser displays the SSI code as if it was hard coded onto that page.
Using the same SSI on several web pages can decrease file size and speed up the time it takes for a web page to download. Once the SSI is cached it doesn't have to load
again. This makes it a good solution for large websites where the same header may be used on many pages.
Note:
Any page that uses SSI must end in the extension ".shtml".
On this page:
Displaying the Date and Time
- Add the following SSI code to your web page where you want the date to be displayed.
<!--#echo var="DATE_LOCAL" -->
- Save your web page with the extension ".shtml"
TOP
Displaying the Last Date a File was Modified
- Add the following SSI code to your web page where you want the date to be displayed.
<!--#flastmod file="web_page_name.shtml" -->
web_page_name.shtml - Replace with the name of the page.
- Save your web page with the extension ".shtml".
TOP
Executing a CGI Script
- Add the following SSI code to your web page.
<!--#exec cgi="/cgi-bin/script.cgi"-->
script.cgi - Replace with the name of the CGI script.
- Save your web page with the extension ".shtml".
TOP
Including a File
- Add the following SSI code on your web page where you want a file to be included. The file can be virtually any web-acceptable file format including ".txt", ".html", ".htm", ".phtml", etc.
<!--#include file="file.txt"-->
file.txt - Replace with the name of the file you wish to include.
- Save your web page with the extension ".shtml".
TOP
|