|
KB Categories
· Getting Started
· General Info
· FTP / Uploading
· Email
· Billing
· Scripting / CGI
· PHP
· SSI
· .htaccess
· CGI-BIN
· FormMail
· Guestbook
· Stats / Logs
· MS Frontpage Extns
· eCommerce
· Secure Telnet (SSH)
· MySQL Database
· Show all categories
· Support Home
Search KB
Ask a Question
If you are unable to find the answer to your question in our KB, please Contact Us.
|
|
SSI: How do I use 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.
Below are some examples of how you can use SSI on your web pages:
To display the current date and time:
1. Add the following SSI code to your web page:
<!--#echo var="DATE_LOCAL" -->
2. Save your web page with the extension .shtml
The result will be like this:
Wednesday, 15-Nov-2000 03:27:16 EST
To display the last modified date of a web page:
1. Add the following SSI code to your web page:
<!--#flastmodfile="web_page_name.shtml" -->
2. Save your web page with the extension .shtml
The result will be like this:
Tuesday, 07-Nov-2000 18:16:40 EST
To include a document inside another:
1. Add the following SSI code anywhere on your web page: (The included file doesn't have to be a ".html" file. It can also be a ".txt" file (eg: myfile.txt).)
<!--#include file="myfile.html"-->
If the file you want to include is in a different directory, you will need to use the following command.
<!--#include virtual="/directory/myfile.html"-->
The '/' at the start of the filename tells the computer to start looking at the root of your website for a file called 'myfile.txt' in the folder called 'directory'.
2. Save your web page with the extension .shtml
To execute a CGI script or command directly from a web page:
1. 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"-->
2. Save your web page with the extension .shtml
Please Note: For security reasons EXEC CMD SSI calls are blocked and will not work
Last update: 2005-01-10 23:22
Author: admin
Average rating: 2.5 of 5 (10 Votes )
|
| You can add notes to this KB entry | Content Overview: SSI |
|
|
|