|
By Eddy R.
10/13/99
Server Side Includes are instructions
within web pages that cause the server to insert a file or other
information into an HTML document. SSI are mostly used for items
that appear on many pages and that have to be updated constantly
(such as navigation bars, news updates, etc.)
Here is how to include a SSI in your web pages.
Create the file to be included
For out example, we'll update the navigation bar throughout a web
site.
Open your HTML or text editor (Notepad) and write the HTML that
is to be included in your web page. The HTML should only have the
code you want it to appear on the web page(s). Also, tags such as
<body> or <html> should not be included in the HTML.
Here is an example of what the HTML in this file would look like:
<a href="http://www.webbuilder101.com>Webbuilder101.com</a>
As you may have noticed, there are no <body> or <html>
tags. Once you finish writing the HTML, save the text file as "nav.html".
Include it
You can include the "nav.html" yourself or you can let
your HTML Editor include it for you.
To include the file as a SSI, you must write the following code:
<!--#config virtual="nav.html"-->
Note that this code should be included on every page of your web
site where you want the navigation changes to take effect. The HTML
in the file that is to have the SSI should look something like this:
<html>
<body>
Check out this link:
<!--this is where the SSI code goes-->
<!--#include virtual="nav.html"-->
</body>
</html>
Note that the file extension of the web page that has the SSI must
be .shtml. This extension is necessary because that way, the server
knows it's dealing with SSI.
|