g Text Version
Beauty & Self
Books & Music
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
News & Politics
Religion & Spirituality
Travel & Culture
TV & Movies

Bored? Games!
Take a Quiz
Rate My Photo

Natural Living
Folklore and Mythology
Distance Learning

All times in EST

Clairvoyance: 08:00 PM

Full Schedule
g HTML Site

BellaOnline's HTML Editor


SSI - Server Side Include - II

Guest Author - Diane Cipollo

In the first part of this tutorial we discussed using server side includes to streamline your HTML code. You also learned that the decision to use the file argument or the virtual argument depends on the location of the files on the server. Now we will take a closer look at the file and virtual arguments.

Let's study some examples. For the purpose of these examples, we have two files called index.shtml and about.shtml. These two files contain the SSI code that will "call in" a third file.

Figure 1 File Argument

Figure 2 Virtual Argument

Example 1
<!--#include file="menu.html"-->

As you can see from Figure 1 above, all three of the files (index.shtml, about.shtml and menu.html) are in the same folder on your server. Therefore in this example you will use the file argument in the SSI code. Also the value (on the other side of the equal sign) is simply the name of the file to be included (menu.html). By using the file argument and the name of the file you are telling the server that it can find the file it needs (menu.html) in the same folder as the index.shtml and about.shtml files.

Example 2
<!--#include file="law/legal.html"-->

In this example we still have the SSI code in both the index.shtml and about.shtml webpages. Take a look at Figure 1 again. This time the file we want to include (legal.html) is in a folder below the main folder. This subfolder is called law. Because the legal.html file is in a subfolder you need to add the name of the subfolder in front of the name of the file to be included. Because the law folder is a subfolder of the main folder you will still use the file argument. This tells the server that it can find the file it needs (legal.html) in the law subfolder.

Example 3
<!--#include virtual="/commons/refer.html"-->

Take a look at Figure 2. In this example we still have the SSI code in both the index.shtml and the about.shtml webpages. But this time we will use the virtual argument. Why? Well this time the file to be included (refer.html) is not in the same folder or a subfolder to the main folder. It is in an independent folder on the server. That is to say this folder is "outside" of the main folder. How do you tell the server to look outside of the main folder? You need to add the / in front of the name of the folder. The / stands for the server root or domain name of your webpage ( By using this / and the virtual argument, you are telling the server that it can find the file it needs (refer.html) at the location

This site needs an editor - click to learn more!

Add SSI+%2D+Server+Side+Include+%2D+II to Twitter Add SSI+%2D+Server+Side+Include+%2D+II to Facebook Add SSI+%2D+Server+Side+Include+%2D+II to MySpace Add SSI+%2D+Server+Side+Include+%2D+II to Digg SSI+%2D+Server+Side+Include+%2D+II Add SSI+%2D+Server+Side+Include+%2D+II to Yahoo My Web Add SSI+%2D+Server+Side+Include+%2D+II to Google Bookmarks Add SSI+%2D+Server+Side+Include+%2D+II to Stumbleupon Add SSI+%2D+Server+Side+Include+%2D+II to Reddit

RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map

For FREE email updates, subscribe to the HTML Newsletter

Past Issues

Printer Friendly
tell friend
Tell a Friend
Email Editor

Content copyright © 2018 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.


g features
What's Coming in HTML 5

What is FTP?

HTML Fundamentals - Tables

Archives | Site Map


Past Issues

Note: BellaOnline uses cookies to help provide a consistent user experience. Our advertisers may use cookies to help customize ads. Please contact us with any question about our cookie use.

Summertime Foods
Corn on the Cob
Burgers on the Grill
Apple Pie


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2018 Minerva WebWorks LLC. All rights reserved.

BellaOnline Editor