|
|
The most common use of server side includes is to edit a large amount
of pages just by editing one file. If you have a large site, using server side includes can
make it a breeze to update your pages. As you may have noticed, my pages all have the .shtml
extension instead of the regular .html extension. This is because I use SSI on my site to make
it easier to update. I use it for the left navigation menu, my header, and my footer. My
navigation menu is actually a text file that I upload to my server. A small code included in
my .shtml document calls the text file when needed to make it appear on my site. I can update
every page that has a menu just by updating that one .txt file and uploading it to my server.
Since I have 50 + pages, it makes it so much easier to update. Keep in mind that not all
servers allow the use of SSI, and you will probably have to rename all of your regular .html
documents to .shtml (some servers allow you to continue to use the .html extension, but not
many of them do).
First, rename your regular .html documents to .shtml.
Next, make a text file (you can use Notepad). The text file can include HTML, javascript,
music, whatever you want to show up on a large number of pages. After you've made the text
file, save it with the .txt file extension, name it anything you want.
Insert this code in your .shtml document, changing the info in bold to reflect your
filename:
<!--#include file="yourfilename.txt" -->
Now, when someone accesses your site, the text file will be inserted into your document and
show up as regular html.
It's really not very hard, and it's an awesome tool if you have a large site!
|
|
|
|