Thursday, September 19, 2024

Use Server Side Includes To Ease Your Workload

I’m all for making things as easy as possible. The whole idea in business, and life, is to work smarter not harder. When designing websites, I not only want to create them with as little effort as possible, but I also want to make maintaining them easy.

One way to do this is with Server Side Includes (SSI). SSI’s are an easy way to add or update content to one or more web pages on a site. One way I use SSI’s is for the copyright on my pages. By changing the year in one file, it changes the year on all of my pages. I also use SSI’s for the links on my pages. If I decide to add or remove a link, or rearrange them, I simply make the changes in one file and my entire site is automatically updated. As I said before, make it easy. Why should I go to each of the 80 plus pages on my site to change something when I can do the same thing with one little file?

Another great thing about SSI’s is that you can’t see them on a web page. If you, or anyone, view the contents of your page, the SSI won’t show. Instead, you will only see the HTML put there by the SSI.

Before you try to use SSI’s you need to check with your web host to see if the server is set up for them. Most servers are. If they say they are, then you need to do a little test. Create a web page with the following HTML.

<HTML>
<TITLE>Testing SSI</TITLE>
<!--#config timefmt="%A" -->
<!--#echo var="DATE_LOCAL" -->
</HTML>

Save this as an HTML file and upload it to your server. Now try to open the page with your browser. If you see the current weekday, like Monday, Tuesday, etc. then you can start using SSI’s. If you don’t see anything, rename the file extension. Instead of using HTML use SHTML. Some servers require the “S” and others don’t.

Another thing you need to know is that you shouldn’t use the SHTML extension on your Home or Index page. Spiders don’t like it and won’t be able to Index the page on their search engines.

Now that you know your server will let you use SSI’s, let’s start saving time. The first thing you need to do is create a text (.TXT) file that contains the information you want to include. This can be graphics, text, links or anything else you want to include. You will want to include the HTML that you would normally put on a web page. Think of this text file as something that will be pasted into your web page, since this is exactly what will happen.

If you wanted to include a copyright on each page, then put this into the text file

<p align="center">Copyright 2004 Jeff Colburn</p>

and save it as a text file. Let’s call it copyright.txt.

Now, create the web page where you want the copyright to go. In the place where you want to see the copyright, put

<!--#include virtual="copyright.txt"-->

then upload this web page to your server. When you go to this page with your browser, you will see the copyright information where you want it.

If the copyright doesn’t show up, recheck the above command. Be sure the spacing and capitalization are correct.

I usually put these text files in my main folder with all the SHTML files. Another option is to put all of the SSI text files into their own folder. If you do that, then the command will look like this

<!--#include virtual="/directory/copyright.txt"-->

Replace the word “directory” with the name of the directory where your text files are located.

Now you can use SSI’s to include anything you want on various pages. And feel free to include as many SSI’s on a web page as you want. I use up to five on some of my pages. The real secret is to carefully plan out your site and its future growth. This way you can include SSI’s as you create your site, instead of adding them to your site after it’s completed.

So have fun with SSI’s, be creative and let your server do as much of your work as possible.

http://www.CreativeCauldron.com

Jeff Colburn is a website designer and writer. His goal is to make the process of creating or updating your website easy and simple for you, while creating a website that meets all your needs and expectations. Jeff can also create all of the copy for your website.

To see a sample of Jeff’s work go to The Creative Cauldron. It’s an award winning site filled with information for writers, photographers, artists and other creative people.

Copyright 2004 Jeff Colburn

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles