|
Server-Side
Includes (SSI)
What are Server-Side Includes?
Server Side Include (SSI) is a feature of CGI (in conjunction with
your server) that allows you to dynamically insert a piece of information
including the current date, any HTML file, and execute CGI/PERL scripts
in your web page. The browser displays the SSI code as if it was hard
coded onto that page.
How can I use SSI on my web
pages?
To display the current date and time:
- Add the following SSI code to your web page:
<!--#echo var="DATE_LOCAL" -->
- Save your web page with the extension .shtml
The result is this:
Tuesday, 11-Jul-2000 20:41:53 EDT
To display the last modified date of a web page:
- Add the following SSI code to your web page:
<!--#flastmod file="web_page_name.shtml" -->
- Save your web page with the extension .shtml
The result is this:
Thursday, 06-Jul-2000 16:37:27 EDT
(We used the following code because this page is called ssi.shtml.)
<!--#flastmod file="ssi.shtml" -->
To include a document inside another:
- Add the following SSI code anywhere on your web page: (The included
file doesn't have to be a ".htm" file. It can also be a
".txt" file (ie: myfile.txt).)
<!--#include file="myfile.htm"-->
- Save your web page with the extension .shtml
To execute a CGI script or command
directly from a web page:
- Add the following SSI code to your web page:
(Of course, you'll need to change "myscript.cgi" to the
script you're trying to call.)
<!--#exec cgi="/cgi-bin/myscript.cgi"-->
- Save your web page with the extension .shtml
back to top
|