Templates, Re-architected
When templates were first introduced in Dreamweaver 4, designers found them to be an easy way to increase productivity. Instead of making a change to a page element and then applying that same change to every page on the site, they can change just the template. When the altered template is saved, Dreamweaver updates all the child pages in a single operation. All that's left for the designer is to upload the newly modified pages.Templates originally were solely within the Dreamweaver domain and were treated as a tool for Web-savvy designers. The typical style of developing a template was to declare a single editable region for the page's content and to lock the core elements of the pageas in logo and navigation section locking. This practice gave the Dreamweaver designer the most freedom while handling key maintenance chores. There was little concern that inappropriately styled content would be added to the editable region; after all, it was the designer's job to make sure that the content was presented correctly. Moreover, an open content area gave the designer lots of room to be creative and to use any of the available Dreamweaver power tools as needed.
How Templates WorkAny Web pagestatic or dynamiccan be saved as a template. When a page is designated as a template, Dreamweaver appends a .dwt file extension and inserts a few lines of code in the form of a118 comment. Initially, all the content in the <body> area of the page is locked and cannot be altered on any page derived from the template. Two areas of the <head> are marked as editable regions: one surrounding the document title, and another placed to hold style sheets and JavaScript.An editable region is a section of the page, either empty or with placeholder material, enclosing an area that can be modified when a child page is derived from the template. Part of the template development process is designating one or more editable regions in the <body>. Each editable region is uniquely named and designated in Design view with a surrounding border and a small tab displaying the region name. In the code, these regions are marked by specially formatte108 comments.After the template has been constructed, designers create pages based on that template. Each of these child pages maintains a connection to the master template unless purposely detached. Whenever the locked areas of the original template are altered, the same changes are applied to the corresponding section of each child page; the editable sections remain unchanged.All the template operations in Dreamweaver are handled client-side within the local site. Consequently, any updated child pages must be published to the remote Web site. |