Guide Categories:  Home | Drivers | Web Development | Hardware | Internet | Q & A | Tips & Tricks | Write
Web Development Silicon Guide
Search SiliconGuide:

Site Services:
Log In
Sign Up

Guides:
Getting Sponsored
Using SSI

#!/usr/bin/perl print < end

#!/usr/bin/perl $random = int(rand(10)); #$random = 10; if ($ENV{'REQUEST_URI'} eq "/qa/forum/messages/259.shtml") { print <
Older printer drivers are always hard to find. How about the ink cartridges for them? Dell ink is the hardest to find. Printer ink for the older machines can be easy to find if you know right where to look. Shop around to find the best deals on inkjet and toner cartridges.
end } elsif ($ENV{'REQUEST_URI'} eq "/tips/win95/office/office.shtml") { print <
Need a place for your Internet mail? Then Exchange email outsourcing is the way to go! No hassles, no coding experience, very little microsoft exchange server experience required at all.
end } elsif ($ENV{'REQUEST_URI'} eq "/internet/napster/4.shtml") { print <
Looking for mp3 players? Need a place to share your music. If you compare prices on some of the top MP3 players, you will notice that they are very inexpensive. Price comparison can be very beneficial to you.
end } elsif ($ENV{'REQUEST_URI'} eq "/qa/forum/messages/975.shtml") { print <
When designing pets in Sims, you may remember that you need pet supplies for your real pet. As much as its just a game, your real pet needs some lovin' right now. Go buy them a Pet Bed, and or teach your Dog some tricks.
end } elsif ($random eq -1) { print < end } elsif ($random eq -2) { @siliconmail_banners=("mail1.gif","mail2.gif","mail3.gif","mail4.gif","mail5.gif"); $ran2 = int(rand(5)); print < Silicon Mail end } elsif (($random >= 0) && ($random <= 7)) { print < end } elsif (($random > 7) && ($random <= 8)) { print < end } else { print < end } #print < #
# #end

The Silicon Guide To
Using Server Side Includes

Including Files

This is where the big time saving comes in.  By using the include command, you can insert the contents of any text file (which can contain html) into the current HTML document.

Syntax:

<!--#include virtual="LOCATION_OF_FILE"-->

where LOCATION_OF_FILE is a regular path to the file you want to include (this can be relative as in "ssipages/menubar.shtml" or direct as in "http://yourdomain.com/ssipages/menubar.shtml").

For instance, if you want to include a top navigation bar, that will be the same in all your pages, your HTML pages would look as follows:

<html><head><title>My Home Page</title></head>
<body bgcolor=ffffff>
<!--#include virtual="menubar.txt">
<h1>Welcome to my Site</h1>
<p>Here you will find lots of useful information</p>
</body></html>

where <!--#include virtual="menubar.txt"> would be replaced by the content found in the file menubar.txt.  This allows you to simply edit menubar.txt whenever you wish to modify your navigation bar, and the changes will take affect on all pages that included the content of that file.  No more modifying every darn page on your site just to change content that is the same across all your pages.

This is what we do here at Silicon Guide, as you may have noticed that all our pages end in .shtml.  However, we use a different menu bar file for every section.  The footer at the bottom of all the pages, is also located in only one file.  Of course, if you check our source you won't see the actual SSI commands, since the server replaced them with the actual content they were ment to display.

Many other sites use SSI in this way, AltaVista being one of them.

Your server side includes may not work if you use them within a file that is being included, however naming the included file with .html or .shtml instead of .txt (or any other extension) often solves the problem.

Next Page:
Executing CGI Scripts
Skip Ahead:
SSI Hosting and Conclusion

Home | Web Development | Hardware and Upgrading | Internet | Technical Questions & Answers | Tips and Tricks | Write to Us

Last modified on: Tuesday, October 15 2002 at 04:44 PM - UTC
Copyright © 1999 - 2012 SiliconPharm Corporation, All Rights Reserved
Powered by Apache/2.4.54 (Debian) (More Info)