For some reason, every web design class I took in college taught me to build sites using Adobe Dreamweaver (Macromedia at the time). While there are many non-WYSIWYG alternatives to this approach (HomeSite, TextPad, TextMate, Notepad++, Coda, etc.) I had never heard much about people using them or they didn’t exist yet. Perhaps this had to do with the rock I was living under?
A good deal of Dreamweaver’s web design features happen to be very convenient. Many of these features basically hold your hand through the coding process if not actually doing large portions for you. This can help a beginner accomplish things he/she doesn’t fully understand. Although we were warned in school not to rely solely on the Design View and to keep a close eye on the code that it automatically produced, it is pretty easy to become distanced from the code and rely heavily on Dreamweaver to do almost everything for you. Suddenly, you might realize you can’t remember some very basic code because Dreamweaver is always doing it for you. I forgot my parent’s home phone number once for the same reason… my cell phone stores it so why bother memorizing it? Whoops, battery is dead, what was that number?!
Without getting into the specifics of each one of these useful yet flawed do-it-for-me coding tools, I wanted to touch on what I think has been the most advantageous feature to quit using; Dreamweaver’s templating system. At first glance, this proprietary trick was a huge time saver. Make a change to one template file and like magic the app sneaks into each dependent file and updates the code for you. Slick, right? Sort of. Now you have to upload all those files affected by the change. This leaves room for error and can be time consuming on larger sites. Occasionally the program will simply bug out and fail to apply the changes to every single page. Not fun.
The other main problem I’ve experienced is with the limitations of the non-editable region areas. Sometimes a site will require different navigation on each page, different coulmn of information on select pages, or any number of unique challenges. This could be accomplished with mutiple templates and/or use of the Library Item feature but things would get bloated and cumbersome pretty quickly. Another bug I’ve run into happens when you make certain changes, well within the editable region of a given page, and Dreamweaver will not allow this change. It claims you are disturbing the template saying, “Making this change would require changing code that is locked by a template or translator. The change will be discarded.” Even if the change is something simple like a <p> tag well withing the limits of the editable region. These factors are frustrating, produce sloppy code, are less flexible, and can make you a lazy developer.
Enter: server-side includes. Whatever language or environment you are in, using server-side includes (SSI) to build a template structure is more reliable, more flexible, and faster. The different areas of your webpage, header, navigation, footer, etc. can be placed in their own individual files and pulled into your page using includes. If each page pulls in the same file for “header” and you need to change something in the header, this only has to be done once. Only one file needs to be uploaded and immediately the entire site reflects your changes. Beautiful! Any combination of includes can be used to accomplish however many unique situations you can create. Finally, SSIs are not proprietary, anyone on any text editor can easily take advantage of them or edit existing sites that use them.
Of course, some of the safeguards of a Dreamweaver template are lost and generally speaking this could open you up to making mistakes or accidentally breaking something. But, with more power comes more responsibility. You’re ready for that, right?
Utilizing this simple yet powerful solution for templating has made developing and maintaining webites more efficient. If you’d like to see the code behind this technique check out W3 Schools: PHP Includes, ASP Includes , Apache Includes, or hit up wikipedia for some General Info.