Templates allow you to create consistence pages easily that has common graphical interface elements (e.g., header, footer, or sidebar) that can be protected from editing while at the same time exposing other areas (e.g., mainContent) that can be edited by anyone, even without much web experience. Templates, like Library items are specific to a given site; whereas, snippets are global to all sites.
While you can use a new page and add text, graphics etc. to it, it is best practice to create a template from an EXISTING PAGE that matches the "look-and-feel" of your proposed web site. Whether you are using a new or existing page, define a web site and ensure all links (e.g., Home > index.html, Products > products.html, etc.) are correctly pointing to the desired pages you intend to create using the template technique.
If you create a template and save it without defining any region to be modified and then attempt to create a page from it, most of the page will be locked and can not be edited. To make a useful page, you can defined various region(s) in the template to be editable, optional, or repeatable before create any other pages.
IMPORTANT NOTE: Except for the tags between the <head> element (e.g., meta, link, title, script, and style)–which is always editable and the defined regions, all other areas of a page will be locked (e.g., typically, header, footer, and sidebar) if it is created from a template. So it is advisable to let a user know NOT to edit any head tag other than the <title> tag on a page unless they know what they are doing.
To create OTHER REGIONS, select an element or image and define one or more of the following regions in the template.
NOTE: There are several ways to create an editable region:
NOTE: There are two ways to create a repeating table:
IMPORTANT CAUTION: When working with a div element, select the content of the div element and not the div element itself. If you make the div element editable, someone can inadvertently delete the div tag in a page which would wreck your design. So it is best practice to NOT use the Tag Selector. Instead go to the Code View and select the content between the <div> tags. Selecting <div> tags for repeating regions; however, is perfectly acceptable.
CAUTION: Make sure you add the editable region to an element (e.g., <p>Content goes here</p>) and not just plain text (e.g., Content goes here). Otherwise, Dreamweaver may give you problems with CSS.
CAUTION: You can rename a region in the Property Inspector by first clicking the blue tab but other pages that were previously built from this template will be looking for the old name. So it is best to make sure the names are what you want BEFORE you create pages from a template.
If the container has text and/or images, delete them and replace it will some instructional text (e.g., Content for main body goes here...) or an image placeholder. You will be repopulating this region when you create pages that are instances of this template. Repeat these steps for each region you create.
NOTE: To remove any region, select the region and choose Modify > Templates > Remove Template Markup.
Beside making regions editable, you can also make tag attributes editable:
Editable tag attributes – makes a tag properties editable. For example, you can allow changes to the <body> tag so that you can change the background page color or provide a "hook" for CSS in the body tag. Another good use for the editable tag attribute is that you can make just the src and alt attribute properties of the image tag editable and the height/width properties non-editable so that the rest of the page can remain intact without any formatting issue. This would not be the case if you made the whole region where the image reside editable.
To make a tag attribute editable, select the tag using the Tag Selector and choose Modify > Templates > Make Attribute Editable. In the dialog box:
NOTE: When making the <img> element attributes editable for an image, Dreamweaver will display a broken-image icon which is normal in the template.
To remove the tag attribute editability, choose Modify > Templates > make Attribute Editable and deselect the "Make attribute editable" checkbox.
Once a template is created, you can create all of the other pages BASED OFF of this template.
If you don't want to link a new page to a template, deselect the "Update page when template changes" checkbox which will create a regular page with no editable regions. This technique is useful if you are changing the design or creating another type of template from an existing one.
CAUTION: Remember to reselect the "Update page when template changes" checkbox; otherwise, newer pages will inherit this setting.
The time-saver and power of a template comes into play when you have to make change(s) to the common areas that was NOT defined as a region.
It is important to remember that if you change a template, ALL PAGES based on that template has to be uploaded to the server. If you only made changes to a given page, only that page and any dependent files (image, JavaScript, or CSS) that has changed only need to be uploaded to a server.
You are not limited to creating pages FROM a template. You can APPLY a template to an EXISTING page. Dreamweaver attempts to match the existing content to the template's regions. If it can not find a match, it will display a Inconsistent Region Names dialog box so the you can reconcile the differences.
You can also create nested templates which can inherit design elements from a master template. SEE PAGE 582-591 & page 595,598 of Dreamweaver MX 2004 by David McFarland.