Golden Oldies: Server Side Includes

If you are using ColdFusion, Active Server Pages, PHP or another server-side scripting language, you have the ability to create server-side include files. These are text files containing code that is inserted into your pages before the web server sends them to visiting web browsers. Because multiple HTML pages can link to the same include file, it is also possible to change the include file and have it instantly update in all of the pages that use it.

Although similar to linking scripts, include files differ in two ways.

• An include file can contain either server-side code, HTML content, or both.
• The page sent to the web browser is seamless, and there is no indicator that an include file has been inserted. Users cannot see any server-side code.

In Dreamweaver MX, if you link to a database you will be asked to enter details of its location (called a DSN, or Data Source Name), and provide details of the user and password which is allowed to access the database. Dreamweaver MX places these details into an include file

We use an include file on the Phireworx site to hold all the code that visiting search engines look for, which in enclosed in <meta> tags. Meta tags while important, take up a lot of space on a page and are only changed occasionally. So when you are editing these pages all the time, you just don’t need to see them. We removed the meta tags from our pages and placed them into an include file called

Now all we have to do is write a single line of code linking this file into our page.

< !–#include file=”../../../code/include_files/” –>

When the page is sent to the web browser by the web server, the content inside the Include file is added to the page, offering a seamless piece of code to the visitor.

To build efficient, updateable sites, you should try to separate repeating assets, whether they are custom JavaScript functions or the formatting instructions for picture captions, from individual elements on individual pages.

The twin benefit of all these approaches is that you both save time during development and vastly simplify site maintenance. What is important at this stage is that you start thinking about which elements are unique and which are repeated, and you think about how you plan to separate them before you define your site in Dreamweaver or start building any pages.