![]() |
This article is copyrighted by John Wilson but may be reproduced on your website if this resource box is included and if the links are kept live. For more information on design, hosting and promotion of websites visit |
Using Server Side Includes on Your Website
Server side means the action takes place on the Webserver side on the connection. The other side is the Client side- Your Computer.
The most common use of Server Side Includes comes from the Includes part. It allows you to specify an HTML file or a text file and include it as part of your webpage.
The file that is going to have another file included is generally save with an extension of .shtm or .shtml. This makes is easier for the webserver, since, when it sees such an extension, it knows to look for SSI commands.
SSI commands follow the general format of
<!--#command attribute=value attribute=value …-->
for including my file, here’s the command:
<!--#include file="resource-box5.html"-->
Don’t include any extra spaces or it won't work.
It's best to have the file that you want included in the same directory as the page that will include it.
Why you can't use View Source to see the ssi command using right-click here.
You will NOT be able to view the source code of this page to see the include command near the top. That’s because my webserver has replaced the command with the contents of the resource-box5.html before it sent the page to your browser.
You should, however, see my Resource Box at the top of the page in your browser. It contains an image on the left and copyright information and a link which I choose to advertise. That Resource Box is the only thing in the body of the file named: resource-box5.html
Use It For Recommended Sites
Another use for the include command is to use it to display a list of Favorite or Recommend links on your website to send visitors to other sites. These links might appear on most if not all your web pages. If you decided to make a change or to add another link to the list, you now only have to change the one file that actually contained the links. All other web pages that had it included would automatically display the newly revised list, instantly.
example:
Navigation Bar
Basically the same thing but for a different use would be to include a Site Navigation Bar at the top of all your pages. You have only one file to edit to change all pages. You could also have different Navigation Bars for different Sections of your site. Say one for HTML information, another for Style Sheets, etc.
example:
| Dollarware HomePage | How to backup website | How to design website | Write Articles to get free Ads | Contact Us |
My Webserver knows your I. P. Address
Another command which will display the actual I. P. address of the visitor to your site is:
<!--#echo var="REMOTE_ADDR" --> Yours is:38.107.179.231
You should see your own I. P. address display in the line above on the website.
Make a Website Template
You can create a template for your pages using SSI. First, draw out an outline of how you would like the pages to layout, then break it up into sections. Create an include file to produce what you want to display in each section, logos, navigation bars, favorite links or anything you could put in an ordinary .html page.
A Content section could be where you would place unique content for each page.
example layout sketch for website template
Create Printer Friendly Page
You can have a link which will have or include the printer friendly sections of the webpage. In other words you could include only the simple, text section of webpage template, while eliminating images, navigation bars, link lists, etc which would not be necessary for the understanding of the page’s content.
You would just leave out those things that would be troublesome for the printer.
Once that page displayed, the user could just print as she chooses.
Click the image for a Printer Friendly Version
of this page.