A Beginners Guide to Server Side Includes


An Introduction to Server Side Includes

Beginner? That's OK!

While much has been written about Server Side Includes (SSIs -also known as Virtual Includes) much of this information is designed for intermediate to advanced webmasters. This article is aimed at beginners. It is assumed that the reader has no prior knowledge of scripting languages, servers, or any other advanced computer skills. This article will introduce the reader to SSIs and explain how they are used in web site development. SSIs are guaranteed to save you time as your web site develops and changes over time.

Servers: just a place for your stuff?

It is important to understand that all the code for your website is stored remotely on a computer called a server. On a very basic level, the server (remote computer) is just a place where you can store the files on the "net." These files would typically contain your web site's HTML code and possibly some files containing pictures or graphics.

For example, a very simple web site might consist of 5 web pages with five corresponding files that are stored on the server. One file is named index.html and we will have four additional files. These files might be named about-me.html , education.html , resume.html , and portfolio.html. We'll say that this simple 5 page web site is run by a freelancer who uses this site as a kind of virtual advertisement.

Servers Part 2: more than storage?

We have established that the server functions as a storage place for our files, but it is important to recognize servers can also do things. Similar to the operating systems software on our personal computers, servers have software that allows them to access and organize files. Servers can also carry out more advanced functions. Take, for example, what the server does when someone visits the root directory of your site; the server automatically loads your index page (e.g., index.html, index.html, index.asp). This is a very simple example of something that happens on the "server side."

Why do I need includes?

Now that we understand that remote servers have software on them capable of carrying out certain tasks, we can turn our attention to the "includes" portion of the equation. What are includes? Let's take our hypothetical web site that serves as an advertisement for our imaginary freelancer. Imagine that the freelancer designs a left hand navigation menu so that people can easily browse all five pages of his site. Therefore, each page of this site contains the code for the navigation bar. Imagine that a few months after launching this web site, our freelancer wants to add a Frequently Asked Questions page. Our freelancer now has to update the navigation bar code in each of his five existing pages. Now there are six pages with this same navigation bar code. A month later our freelancer wants to add a self-written article to his site. Once again every page on the site needs to be updated. Imagine having a site with 100's of pages. Do you want to manually update 100's of pages of code? These are the types of situations where virtual includes can save you hours of time.

What are we including on the server side?

Perhaps it would be better to think of includes as "modules" that we can insert into our web pages. These modules (or "includes") are usually just text files that contain HTML code (although they can be other file formats). The code inside these files can be inserted anywhere in a page simply by using an include command. For example, imagine for a moment that our freelancer had the foresight to realize that the navigation menu would change at some point in the future. Instead of putting the code for the navigation menu into each individual page, the freelancer placed this code into a separate file. For the sake of example, we can call this file nav-menu.html Our freelancer can now simply place an "include" command that refers to the nav-menu.html anywhere he/she wants to place this menu. The advantage of this is becomes apparent when our freelancer needs to modify the navigation menu. Just one file needs to be edited, nav-menu.html, and all the pages containing "include" refering to this file will automatically update themselves. This time savings is the primary advantage of using includes.

OK, I get it, but what does an include look like?

Even though this is not a "technical" article, many of you are probably wondering what an "include" looks like. Therefore, one example for PHP is included below. Please note PHP is just one type of scripting language that can be used, depending on what your server is running. In this example, the code contained in the file "nav-menu.html" will be inserted into any web page where the following code is placed:

Keep in mind that, for technical reasons, server side includes will never be visible when you view the source code for a page in your browser. This is because the include happens on the server (before presenting the resulting code to the browser). This makes the use of SSIs invisible to browsers, bots, spiders (which is why they are search engine friendly)

Summary

The catch-22 of server side includes is that the need for them only becomes apparent when faced with the task of updating tens or hundreds of pages of code. There are many resources on the web that will instruct you how use virtual includes, and procedures will vary depending on the type of scripting language supported by your server (e.g., ASP, PHP). Hopefully you now understand Server Side Includes and how they can benefit the webmaster.

About the authors:

This article was written by the editors of the Kabooli Internet Directory. This article may be used freely in opt-in publications and websites as long as the article not changed in any way and all links in the Authors section are active . A courtesy link to any online posting would be greatly appreciated and can be sent to the editors of the Kabooli Directory by using the Kabooli Internet Directory Contact Form


MORE RESOURCES:
RELATED ARTICLES
Learn to Build a Better Online Business Website Using Keywords and Content
Are you aware that 90% of the websites on the Internet today are a waste of time and space. You have probably been on some of the sites I am referring to.
How to Increase Sales with Automation Improvements
How popular is online shopping? And is there room for improvement? Let's check out some pros and cons of automated shopping and see.Digital carts offer convenience for people around the globe 24 hours a day.
Web Design for the Professional Magician Part I - Selecting the Perfect Domain Name
Selecting the Perfect Domain NameThe first issue I have with magician web sites is the improper use of domain names. Examine the following list of URLs and select the most professional one: www.
Make Your Own Brand!
There are millions and millions of websites on the Internet. You NEED to be different in some way from all of them! If you could get a visitor to your website, that means nothing.
Creating Websites that Cater to Exam Preparations
One of the things that Internet excels is disseminating information and knowledge across many brains and continents. In this global economy the aspirations of the younger generation is not bounded by countries or continents.
Warning: The Truth About Having a Web Site!
If you don't have a web site yet, are thinking of slapping one up or have one that simply isn't producing, this Warning is for you!All too often folks contact me about getting a Web Site when they really have not done their due diligence in determining even if their "idea" is one worth investing in. And although they hate spam and don't believe most of it, they do tend to fall into believing much of the fast, easy and cheap noise online in existence only to line the pockets of shysters and unscrupulous developers.
12 Essential Tips to a Professional Business Website
1. Choose a big enough font size.
Stop Losing Precious Web Site Traffic to the Dreaded World Wide Web Black Hole
You work hard to build traffic to your web page. If you are not doing 1 simple step you are loosing a portion of all your web site traffic to the dreaded World Wide Web Black Hole.
Do You Need a Web Database?
Does My Web Site Require A Web Database?If your web site require constant updates and feeding of information, a web database is the solution. In short, this applies to web sites that handle online products, news feed, members- based subscription and other functions as well.
MySQL Database Handling in PHP
Most interactive websites nowadays require data to be presented dynamically and interactively based on input from the user. For example, a customer may need to log into a retail website to check his purchasing history.
Creating Compelling Content , Write It and They Will Come
In a previous ezinearticles.com article,"I Need real visitors, Not Search Spiders" we discussed the need for content.
Web Success Secret - Keep Your Visitors Interested
Visitors to your site come looking for information or solutions to their problems. They will remain there if they find what they are looking for.
CSS - Maximum Benefits
What is CSS?CSS is a simple file which controls the visual appearance of a Web page without compromising its structure. Using CSS we can control our font size, font color, link color and many other attributes on our web page.
Dreamweaver 8 Preview
August 8 2005, Macromedia announced a release of Studio 8. Based on the feedback of previous users, Macromedia made it's already very powerful software even better.
Developing A Website: 10 Tips For Getting Started
1. Be clear on your purpose.
HTML Editors - How to Choose the Right One for Building Your Websites
There are lots of HTML editors on the market, however, you will want to look for one that has specific tools that will make building your websites easy, straightforward, and as stress-free as possible. Review the following requirements you should look for in an HTML editor.
Make Your Own Website - General Website Design Tips
Wow, we`ve already taken a domain and chosen a web host. Great job ! Now it`s time for something special: making your own website.
Improving Usability for Screen Reader Users
Simply ensuring your website is accessible to screen reader users is unfortunately not enough to ensure these users can find what they're looking for in a reasonably quick and efficient manner. Even if your site is accessible to screen reader users, its usability could be so incredibly poor that they needn't have bothered coming to your site.
Non-Profits: Successful Online Strategies
More and more non-profit organizations are developing websites to help share information about their mission and programs. This involves strategic planning about the best way to present your image and message online.
Develop a Solid Website Presence
Starting an internet business can be confusing to non-veterans. The internet is the new world of business and research.