Webmaster Time Savers - Using Includes


Perhaps the biggest time saver that every webmaster should take advantage of is using includes on their website. By taking the common sections of code of your website and placing those sections of code into include files you will be able to make your website easy to manage and maintain.

There are many different types of includes. If your web host is using Apache you should be able to use a simple Apache include. A common Apache include looks like this:

If you have access to PHP the same include would be like this:

If you are on a Windows server and can use Active Server Pages you can use an include like this:

I have seen many different combinations of includes. Personally I like to use PHP or ASP includes depending on what the server supports. The reason to use a PHP or ASP includes is because you can use the entire header/footer portion of a web page. PHP and ASP includes process the pages that they include which means you can do simple variable substitution to change the title and other meta information of a page. This also means each page only has the content for that page with very clean HTML. The following is a simple example:

Page Heading

Web page content. This can be all kinds of information including text, images, flash and more.

By using includes webmasters can dramatically decrease the time it takes to create and maintain a website. If you are building your own website learn how to use includes it will allow you to focus on creating content for your website, instead of constantly copying repetitive HTML. If you are having a website built for you ask your developer if they plan on using includes to build your website, so you get the most value for your money.

Categories: web-programming