Q.What are Server Side Includes (SSI), and how do I use them?
A. Server Side Includes are relatively simple commands that can be easily inserted into your pages. The server then uses these commands to retrieve information or files to present in the webpage as it is loading. SSI's are able to insert files, a current time, and a counter, among other things.
There are a few user friendly tutorials online that explain the SSI commands well, such as BigNoseBird's tutorial at http://www.bignosebird.com/ssi.shtml or UseForeSite's tutorial at http://www.useforesite.com/tut_ssi.shtml. As a note, our server only uses "mod_include" commands, not "mod_xssi" (or extended SSI), and extended SSI commands will not work if you try to use them.
A few useful commands you may like are the option to add in the current date and time of the person viewing the page, or the ability to create one header or footer document which you can use site-wide and only have to edit on one single page.
Current Time and Date
Example:
Today's date and time is:11/22/08 04:47
Code:
Today's date and time is
<!--#config timefmt="%m/%d/%y %R" -->
<!--#echo var="DATE_LOCAL" -->
Footer
Example:
We have a header file called "mailhere.txt" and in this text file is:
Always mail me here: <a href="mailto:web.support@sonoma.edu"> Web.Support@sonoma.edu.</a>Our SSI enabled web page would then look like this:
Always email me here: Web.Support@sonoma.eduCode:
<!--#include file="mailhere.txt" -->
Once you've placed the commands within your document, save it with an .shtml extention (rather than the normal .html or .htm extentions).
Related FAQ:
