Don't Forget about "Include" Files (.inc)
 

It’s a safe bet that all the pages that comprise your web site will contain duplicative HTML code.  For instance, if you follow my recommendations for site design, your navigation bar will appear on every page.  In addition, if you use Cascading Style Sheets (CSS) to control formatting, that code would also appear in the HTML source document for each page.  Other possibilities include common banners and javascript routines.

So, let’s consider a situation where you now have this really great web site comprised of, let’s say, 50 pages.  But wait!  You want to add a new navigation button or want to change your CSS formatting code.  Does that mean you have to make changes to the HTML code for each of your 50 pages?

No, you don’t if you place these common codes and routines in a “include file”.  In that case, you need to only make the change one time.  Include files utilize a facility known as Server Side Includes (SSI).  SSI is available for both Unix and Windows based servers.

Include files are separate from your main HTML code for each page.  When a visitor to your site goes to your homepage (or any other page), the information in the include file is dynamically placed into the main HTML file by the server before the combined document is sent to the visitor.

For instance, if your navigation buttons required 100 lines of HTML code, instead of placing that code into each of your 50 pages, you would simply use the single line:

<!-- #include file="comm.inc" -->

The 100 lines of code for your navigation would be in the include file. You can name the file anything you want.  I usually use something like comm.inc to indicate a common routine.  Just before the page is sent to the site visitor, the code in the include file replaces the include statement.

As a result, changes as I described above only need to be made in one place, no matter how many pages you have.  I highly recommend using SSI include files.  They will save you a tremendous amount of maintenance effort over time.

 


| Home | About Us | Support | Mailing List | Buy Now | Customer Login |
| Tips/Techniques | Links | Blog | Help Me | Sitemap | Reseller Login |
Copyright 2005-2006: WebHosting-123.com