Navigate
Sponsors
|
SSI Include CommandIntroductionThe purpose of this quick guide is to show you how to include
a file into another file using SSI. In order to
include a file you must use the aptly named INCLUDE
command! Include FileThe "Include File" argument is used when the path to the document we want to include is given relative to the shtml file itself. In other words, the file we want to include is in the same directory as the file which contains the include command or in a directory below the file. You cannot use 'File' to go "up" a directory such as "../include-this.htm" Example: We want to include a copyright notice into main.shtml, so IN main.shtml we add the following: <!--#include file="copyright.txt" --> The contents of copyright.txt could be: <p>Copyright 2002 <a href="http://yourdom.com">You</a>.</p> Result: In main.shtml the following will get displayed: Copyright 2002 You. Include Virtual"Include virtual" should be used when the path to the document is given relative to the document root. Example: The copyright we want to include exists in another sub-directory, so to include the copyright into file.shtml we use the following: <!--#include virtual="/home/includes/copyright.txt" --> The result will be the same as above. File Extensions of Included FilesThe file to include can generally have any extension. I usually use .txt, but .htm .html .inc etc is also fine. If the document to be included contains SSI code which will need to be parsed by the server then it will have to have the extension .shtml or whatever your server is set-up to parse (process). |