Replacing Old Website Templates in Dreamweaver

Part 2 - Turning a Website with Multiple Templates into a Website with One Template.

Back to Part 1 - Overwriting a Single Template

The procedure for updating a site with multiple templates is similar to changing out a single template, but with a few more steps. The problem with my legacy site, with multiple templates, was that the editable regions in the various templates did not match. One portal template had a region called lefNav and its main content area was called body1. Other templates had no leftNav, had a textarea instead of body1, and the pages had a closing region. Imagine this problem multiplied by 6 templates, each with different names for their editable regions! The good news is that you can create editable regions right next to each other in a master template. Regions without content will not be visible on the new pages. You must still create editable regions to match each region you are trying to replace. The trick is to create these regions as Optional Editable Regions (choose Insert > Template Objects > Optional Editable Region). Here is a picture of the universal template designed with optional regions for a legacy site called The Scholars Corner (http://www.ScholarsCorner.com) (fig 2):

DW template showing Optional Editable Regions

The title region was common to every template, so that became a regular editable region. The regions in this photo preceded by “if” statements are optional regions. I created this new, universal template and named it 2009.dwt.

Once I created this universal template to include all the editable regions of the six existing templates, I went through the process of renaming a copy of the new template for each of the old templates, as outlined in the single template example above. So, if the old templates were 2005.dwt and 2006.dwt, I renamed a separate copy of the 2009 template to match each one. I did this for all of the old template names and then updated all their child pages. After stepping through this process for each of the old templates, all my pages now matched the new design and layout.

However, I was still stuck with 6 identical templates with 6 different names. All the pages looked alike, but I did not want to be forced to modify 6 templates every time I needed to make a design change, so I took the next bold step. Every child page (every page that is created from a template) will have in its code, near the top of its header, a tag linking it to its parent. It will look something like this:

Begining of code

This tag tells you that the page was created using a template called 2007.dwt. That code allows Dreamweaver to know which pages must be updated when you make a change to a particular template.

The final step in the process must be done using the find & replace feature. Because the name of the template’s parent is in a locked region of the child page’s code, you cannot edit the parent tag within Dreamweaver using normal find and replace on the page or by editing the code by hand. Dreamweaver will prevent you from making the changes to selected or open files. The only way to update this code on multiple pages at the same time is to use the very powerful and very dangerous find/replace feature in Dreamweaver using the Entire Local Site/Source Code command (fig 3). In this case, I did a global find/replace on the source code of /Templates/2007.dwt and replaced it with the source code /Templates/2009.dwt. Since this code only appears in child pages, it will not make changes on any of the parent templates.

Find and Replace action

The result is that all pages created with 2007.dwt now tell Dreamweaver that they were created with the 2009 template instead:

child tags

From this point on, any change made to the new 2009.dwt template will update these pages as well.

I followed this Entire Local Site renaming procedure for all of the child pages with tagged links to other templates: 2003.dwt, 2004.dwt, etc. By the time I was done, every single child page listed its parent as 2009.dwt, and any change made to the 2009 template will update every single page on the website. After completing these updates, none of the pages were linked to the old template names like 2006.dwt or 2007.dwt, and I could safely discard those templates.

If I had chosen to update a 300-page site by hand, copying and pasting the content of each page into the new template, what took me only a day, would have taken me perhaps a week of labor. I hope you find this workflow feature a helpful addition to your Webmaster’s bag of tricks.

 

Jefferis Peterson is a Macintosh pioneer, acquiring his first 128k Mac in 1984. In 1993, he produced one of the first Internet magazines called, O Theophilus, and some of the first educational courses for the web. He started his own web design and marketing company in 1999, Peterson Design Studio (http://www.PetersonSales.com), and is still acquiring new clients. Jefferis is also an author and a part-time writer/theologian for The Scholar's Corner.

 

---

PUBLISHERS and EDITORS - Rules for Reprint

You must include the complete article in its entirety.
You must include the complete Resource Box in its entirety.
You must forward a copy of the published article to the Author
at the stated Contact Address: 111 S. Magnolia Dr., Butler, PA 16001
If you neglect any of the above three rules, then you will be
in violation of copyright. Copyright Infringement is a crime.
These rules are simple, follow them and enjoy the benefits of
free reprint rights. Download WORD DOC

---

WEBMASTERS - Rules for Reprint

You must include the complete article in its entirety.
You must include the complete Resource Box in its entirety.
You must set all links to hyperlinks.
You must notify the Author as to the URL where the article resides, at the stated Contact Address:
(use contact form at http://www.petersonsales.net/contact2006.html )
If you neglect any of the above three rules, then you will be in violation of copyright. Copyright Infringement is a crime.
These rules are simple, follow them and enjoy the benefits of free reprint rights.

Download WEB version

 

Please take a few minutes to read our Testimonials