CGI Programming on the World Wide WebBy Shishir Gundavaram1st Edition March 1996 This book is out of print, but it has been made available online through the O'Reilly Open Books Project. |
5.4 Including Boilerplates
There are times when you will have certain information that you repeat in numerous documents on the server, like your signature, or a thank-you note. In cases like this, it's efficient to have that information stored in a file, and insert that file into your various HTML documents with the SSI include command. Suppose you have a signature file like the following stored in address.html:
<HR> <ADDRESS> <PRE> Shishir Gundavaram WWW Software, Inc. White Street 90 Sherman Street Boston, Massachusetts 02115 Cambridge, Massachusetts 02140 shishir@bu.edu The address information was last modified Friday, 22-Dec-95 12:43:00 EST. </PRE> </ADDRESS>You can include the contents of this file in any other HTML document with the following command:
<!--#include file="address.html"-->This will include address.html located in the current directory into another document. You can also use the virtual parameter with the include command to insert a file from a directory relative to the server root:
<!--#include virtual="/public/address.html"-->For our final example, let's include a boilerplate file that contains embedded SSI directives. Here is the address file (address.shtml) with an embedded echo command (note the .shtml extension):
<HR> <ADDRESS> <PRE> Shishir Gundavaram WWW Software, Inc. White Street 90 Sherman Street Boston, Massachusetts 02115 Cambridge, Massachusetts 02140 shishir@bu.edu The address information was last modified on <!--#echo var="LAST_MODIFIED"-->. </PRE> </ADDRESS>When you include this address file into an HTML document, it will contain your signature along with the date the file was last modified.
Back to: CGI Programming on the World Wide Web
© 2001, O'Reilly & Associates, Inc.