Shamash, The Jewish Network Hebrew College     TES Ad
   Shamash Home  °    About  °   Create a list  °   Help  °   Mailing Lists  °   Jewish News  °   Links  °   Search  °   Staff  
   Kosher Database  °   Tanach/Bible  °   Holocaust  °   Jewish Books  °   Israel  °   Software/Graphics  °   Donate  
Server Side Includes (SSI)

[ What is SSI? | How do I do SSI? | Examples]
[ When should I use JavaScript instead? [ Transition issues | More help? ]

What is Server Side Includes (SSI)?

Server Side Includes (SSI) allows the webmaster to create pages which are dynamically created each time they are viewed. This allows for information to be automatically updated in pages, but it also means that pages will take longer to appear, and place a greater load on the Shamash web server when loading.

SSI lets you embed a number of special 'commands' into the HTML itself. When the server reads an SSI document, it looks for these commands and performs the necessary action. For example, there is an SSI command which includes one file within another file.

Shamash has enabled Server Side Includes, but disabled for security reasons the the #exec command and #include of CGI scripts. At the current time we are not using XSSI.

SSI has been around for a very, very long time in the history of the world wide web. Thus, almost all browsers support it, unless they are truely antique. All the 'work' of SSI is done on the shamash server, not the client browser.

How do I use SSI?

To have a web page parsed by Server Side includes (SSI), it needs to end in .shtml instead of .html or .htm.

You then need to include some special SSI commands in your HTML. There are SSI commands which get the size of a file or URL, the contents of a variable (passed in by the server), the contents of another file or URL. Bascially, for each SSI command you need to have the format:

<!--#command arg1="value1 arg2="value2 ... -->
where arg1, arg2, etc are the names of the arguments and value1, value2 etc are the values of those arguments. Please also note that all SSI commands go within an <!--HTML comment -->

Can you provide an example?

Example One

This html includes a file menu.html into this document. That way, changes to the web sites menu may be made in menu.html and it will be reflected on each page which 'includes' menu.html in it. Example:
<table border>
<tr>
<td width="25%">
<!-- This is a menu of options for our site -->
<!--#include file="menu.html" -->
</td>
<td><!-- The body goes here -->
This is the body of the web page here
</td>
</tr>
</table>

The output looks like this:


Shamash Home Page

Shamash Help Pages

This is the body of the web page here

Example Two

This is an example of how you can have the server provide some of its variables on your page. Shamash uses this on our "File Not Found" err404.shtml pages.
If this problem persists, contact <a href="mailto:webmaster@domain.xxx">webmaster@domain.xxx</a>.
When emailing us, please copy the following few lines of text into your email:
<tt>
<br>   <b>URL:</b> http://<!--#echo var="HTTP_HOST" var="REQUEST_URI"-->
<br>   <b>Web Browser:</b> <!--#echo var="HTTP_USER_AGENT"-->
<br>   <b>Remote Host:</b> <!--#echo var="REMOTE_HOST" var="REMOTE_IDENT"-->
<br>   <b>Date/Time:</b> <!--#echo var="DATE_LOCAL"-->
<br>   <b>Refering Page:</b> <!--#echo var="HTTP_REFERER"-->
</tt>

The output looks like this:

If this problem persists, contact webmaster@domain.xxx. When emailing us, please copy the following few lines of text into your email:
   URL: http://www.shamash.org/help/ssi.shtml
   Web Browser: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
   Remote Host: (none)(none)
   Date/Time: Friday, 09-May-2008 18:08:56 EDT
   Refering Page: (none)

Please recall that these will ONLY work if they appear in a file which has a name ending in in .shtml

When should I use JavaScript instead of SSI?

SSI originally was used frequently to report when a page was last updated (the date and time). Yet today, it is much faster and better to have the date the file was last updated to be reported by JavaScript, rather than server side includes. Sham ash uses JavaScript to do this on most of our pages. You may do this quite simply by adding the following to each of your web pages (they can be .html or .htm pages and not SSI, thus the pages don't take as long to be created.):
<br>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide from non-JavaScript browsers
document.write("Last updated: "+document.lastModified);
// end hiding -->
</SCRIPT>
<br>

The output looks like:

What else should I know if I'm moving to SSI from 'normal' web pages?

Many people point their browsers to a directory, and their home page is kept in a file called index.html. If you planned to use, or have been using, an index.html then you may replace that with a index.shtml file, if you need the features of SSI on your home page. When the web server is sent to a directory (instead of a file), it first checks for an index.html file, and if it doesn't find one then it looks for the index.shtml file. So, be sure to remove (or rename) the index.html file from your direct ory if you want the web server to use the index.shtml file as your home page.

Be sure to redirect your old .html pages to .shtml pages during your upgrade. This is especially important if people enter your site through a variety of different ways, some may go to http://shamash.org/YOURLOGIN/ while others may go to http://shamash.o rg/YOURLOGIN/index.html or http://shamash.org/YOURLOGIN/anotherpage.html. Thus, for each .html page you get rid of, and create a .shtml page, you should direct the user from the old .html page to the new .shtml page. A good way to do this, is explained in the Shamash Webmaster's FAQ. Basically, you'll need to create a short .html page that points people to the .shtml page.

Where can I get more help?

Technical documentation about SSI can be found at: Shamash supports SSI, but our staff cannot troubleshoot problems that you are having with SSI on your pages. Please use the webmasters@shamash.org list (or if you are a UAHC webmaster, feel free to also use the uahc-web@shamash.org list) to discuss th ese matters.


This page has been viewed times since January 1, 1998.
Web Author: webmaster@shamash.org

SHAMASH
Donate to Shamash with PayPal!
Tax Deductible
[ Search | Help ]

Copyright © 1990-2008 Shamash: The Jewish Network. All rights reserved.
http://shamash.org