|
Web Space: SSI Essentials
SSI stands for 'Server Side Includes' and allows you to embed special directives in an HTML document to execute other programs or insert various pieces of data such as variables and file statistics.
If your web page requires SSI processing you need to give the filename the '.shtml' file extension (e.g. 'mypage.shtml').
Displaying the Date and Time:
To display the local date and time on a web page, copy and paste the red text below into an HTML document.
<!-- #echo var="DATE_LOCAL" -->
This will show something like:
Monday, 06-Nov-2000 15:58:18 GMT
Remember, you will need to give the page an SHTML file extension in order for SSI to work (e.g. 'mypage.shtml').
File Last Modified Date & Time
As another example of what SSI can do, you can automatically insert the date that your page was last updated, instead of physically typing in the date each time you update the page. With SSI you simply insert the following command in to your page:
Page last modified on <!-- #echo var="LAST_MODIFIED" -->
This will show something like:
Page last modified on Monday, 06-Nov-2000 15:58:18 GMT
Remember, you will need to give the page an SHTML file extension in order for SSI to work (e.g. 'mypage.shtml').
SSI Include Files
An 'include' is a way of embedding information from a single file into single or multiple web pages. This is particularly useful for multiple web pages which need to show the same piece of information. Once set up you then only need to change one file to change that information across all of your pages.
An SSI include command looks like this:
<!-- #include virtual="filename.txt" -->
Place this command on the web page(s) exactly where you want the information from the source page to appear. Lets say you have a website and on every page you show a 'quote of the day'. The quote would be saved in a separate file (say 'quote.txt') as plain text and then you could use the following code on every web page where you want it shown:
Todays quote is: <!-- #include virtual="quote.txt" -->
The source file can even contain HTML characters if required. Includes can save you time and effort when it comes to updating your web site so it's well worth a look for anybody with more than a few pages on their web site. The file that contains the SSI include must have a '.shtml' extension (e.g. mypage.shtml'). The source file can have any name with or without a file extension (e.g. 'filename.html', 'filename.txt' or just 'filename').
|