Server-Side Includes: A No-Brainer

We recently re-designed a large web site for an organization. On the outside, the site looked brilliant – it was colorful, attractive, and kept visitors entertained. Underneath that facade, however, the site’s source code was a nightmare. There was a lot of inconsistency between each page’s source code. What we initially anticipated to be a simple web site re-design became a week-long project. All too often, many web designers share a similar fate. The solution: server-side includes.

As mentioned earlier, the problem was contained within the site’s source code. The original site’s designer failed to incorporate “server-side includes.” These are lines of code located within the site’s source code which instruct the site’s web server to “include” content that is meant to be found on every page of the site. Most commonly, server-side includes are used when building a site’s navigation. After all, who wants to manually update every single page of a web site when seeking to modify the links contained in the navigation? Not you, not us, no one – in fact.

Server-side includes are most commonly incorporated using the PHP scripting language. We proudly use this language and related server-side includes on this web site, and have done so for many years. It works in all situations. Though we won’t go into technical details in this post (click here to learn more), most server-side includes are only a few lines long and incorporate seamlessly into your site’s content. Your site’s visitors never see this code, as it is replaced by the “included” content when rendered in a web browser.

With server-side includes, you only have to update one file when making changes to a web site’s navigation, header or footer, for example. That saves you a lot of time and effort. Learning how to use server-side includes is a small step we can all afford to take.