There are probably two main ways that you update your website. First, you add new content. Whether you're adding a new page, updating a calendar, or displaying a photo of a new product, you're making your site more valuable for your visitors.
The second, more time-consuming changes are the ones that
you have to make to every page of your site. These changes might include your contact information, navigation links, or copyright dates. If your site is rather large, just changing your contact email address on every page can be a boring and time-consuming job.
Most modern web design tools (like Dreamweaver) have a template feature that allows a webmaster to change one section of a single page (say the copyright information) and the software will automatically change every page that was created from that template. Those altered pages still reside on the webmaster's computer however. Each page must be uploaded to the server one page at a time. Depending on the number of pages, how large they are, and the speed of the modem, updating a site this way can take quite some time.
A quicker and much easier way to update your site is to use SSI (Server Side Includes). As an example, we'll go through the process of updating contact information which is usually found at the bottom of every page of most websites.
Here's how it's done
The webmaster creates a new page that only contains the contact information. The new page is saved as a regular HTML file.
Next, he decides where on each page of the site to place the contact information. In that spot, instead of typing in your address, phone number and email, he places a single line of code that might look something like this:
< !--#include virtual="../includes/contactSSI.html"-->
This code instructs the server to take whatever code is on the contactSSI.html page and place it in this location.
Then he renames each page to end with .shtml instead of
the plain .html ending.
For instance, the URL of your website's home page might be www.yourcompany.com/index.shtml. The .shtml extension tells the server that this page has a Server Side Include in it.
The server must take the code on the included page and insert it into the designated spot on your homepage. Each time this page is loaded, the server will read the SSI included page and insert its content into the designated area of the homepage. The same process takes place for every page on your site that uses the included file.
How all of this saves time
Once all of your pages have been changed to use the SSI call, updating every single page of a large site is a simple 2-step process:
- The SSI page is changed (for our example this would be contactSSI.html).
- That single web page is uploaded to the server. That's all there is to it!
Now, every page with a .shtml ending that uses the SSI file contactSSI.html will instantly show the change without the entire site having to be altered and uploaded to the server!
Another common use of SSI is updating a navigation menu. Let's say your site has 500 pages and you want to add a new FAQ page to the site. If you want the FAQ page to be accessible from every page on the site you'll have to change and then upload all 500 pages.
But with SSI you simply change the navigation page (say navigationSSI.html). You then upload this one file and your new FAQ page is instantly accessible from every page on your site by a new navigation link!
I use SSI on my website each time I add a new article. At the top of every page I have a "pointer" to my SSI page. On that page it just says, "This week's article is..." with the article name and a link to it. Each time I add a new article to my website I simply change the title (and link) on the SSI page and upload it to the server. Every page on the site now has the new article name and link. Very simple and super fast.
Conclusion
If you have a small site, you probably don't need to use Server Side Includes. But as your site grows (and it probably will), these little snippets of code will save you a considerable amount of time and money.
This article is courtesy of Les Goss.
Visit Les at: ZMoon.com.
More Interesting Articles |