Accessibility

TechNote (Archived)

Important information to consider when using templates

Introduction

Developers can use templates to maintain a consistent look for their web site and to ease site maintenance. However, there are development, design, and other issues to consider when using templates.

Site development considerations

Developers considering using templates should understand how templates will work within their site structure, and how to make use of templates within the site.

Understand path structure

Developers working with templates will benefit from understanding how paths are written in relation to the template structure. See the following TechNotes for additional information about path structure.

Consider templates when first creating a site

A template and Dreamweaver's Site window can be used to create a complete site in a few simple steps. See the following TechNote for information about creating a site using a template.

Design considerations

The following recommendations can help a developer when creating a template.

Understand the methodology

Until you are accustomed to working with templates, it can be difficult to understand the differences between editable and noneditable regions and how these types of code act in pages based on a template.

Create the template first

It is best to create the template first. Templates are essentially pages with blocks of code either locked or not. Locked code regions will not be editable in a page that uses a template, while editable regions will. Different versions of Dreamweaver may automatically lock differing amounts of content, but developers in any version must still determine a page layout that will most easily allow template users to make needed changes without making unwanted changes.

Dreamweaver 3 and below: A template locks the head of documents created from templates (dependent documents), leaving them uneditable. Any design considerations that require code to be written to the head of a document, such as CSS styles, behaviors and timelines, should be incorporated into the template.

Dreamweaver 4: Developers can add most behaviors, which add JavaScript code to the head of a document, to a page based on a template. Developers can also add CSS styles in pages based on a template in Dreamweaver 4. For more information about any restrictions and workarounds, see the following TechNotes.

Dreamweaver MX: Developers can add content with little restriction and set pre-defined characteristics of locked tags.

Setting page properties

Page properties are set by the template, so options in the dependent documents, such as background image and background color, are determined by the template.

Beginning with Dreamweaver MX, template developers can specify that certain tags should have editable attributes. This allows a template developer to set the bgcolor attribute of thebody tag, for example, to be editable. A developer can then modify the background color of the page in any page based on that template.

Dreamweaver 3 and below: Working with behaviors

Behaviors write JavaScript to the head section as well as to the HTML element in the body section of a document. Since the necessary JavaScript cannot be written to the locked head section, behaviors cannot be assigned in a dependent document. However, there are some workarounds.

Note: This is not an issue with Dreamweaver versions beginning with Dreamweaver MX, and only an issue in certain circumstances in Dreamweaver 4.

Dreamweaver 3 and below: Working with image maps

An image map cannot be added to an image in the editable region of a dependent document without editing the source code.

How to incorporate image maps in templates (TechNote 13880)

However, an image map can be inserted in the template. It is helpful to decide at the design stage whether you want the image map in all dependent pages. If you only want it on some pages, rather than editing the source code of the dependent page, you can create two templates for two sets of documents: one with the image map and one without the image map.

Note: This is not an issue with Dreamweaver versions beginning with Dreamweaver 4.

Converting from layers to tables

Once a file is saved as a template file, the layout options for converting layers and tables are not available. In addition, these options are not available for a dependent document.

Why is the Layout option not available when editing a template? (TechNote 13933)

Considerations when applying a template to existing pages
Other considerations

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_14627
Browser:Chrome
Internet Explorer
Netscape
Opera
Safari
Firefox

Products Affected: