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.
- How to link HTML files in templates (TechNote 14048)
- Understanding Paths in Dreamweaver Templates (TechNote 13842)
- Templates folder appears in path (TechNote 15343)
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.
- Understanding editable and noneditable regions in templates (TechNote 14804)
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.
- Adding content to pages based on a template in Dreamweaver 4 (TechNote 14908).
- Using CSS styles with templates (TechNote 15243).
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.
- Modifying Page Properties in a Template (TechNote 13879)
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.
- New template features in Dreamweaver MX (TechNote 16347)
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.
- Adding behaviors to templates and to documents created from templates (TechNote 14797)
- Using Library items to add behaviors to documents created from templates. (TechNote 14852)
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
- Existing documents to which a template is applied lose any document-specific information already contained in the head of the document.
- In earlier versions of Dreamweaver, any meta tags (such as keywords) except for the title are lost. See the following TechNote for more information: Unable to Assign Keywords in Pages Created from a Template (TechNote 13886).
- Page properties are updated to match the template. See the following TechNote for more information: /cfusion/knowledgebase/index.cfm?id=tn_13886Modifying Page Properties in a Template (TechNote 13879).
Other considerations
- If using layers in a dependent document, use the command from the Insert menu (in Dreamweaver MX 2004, choose Insert > Layout Objects > Layer) to insert a layer in the editable region. The Insert Layer button from the Insert bar does not function properly in dependent documents. See the following TechNote for more information: /cfusion/knowledgebase/index.cfm?id=tn_13886/cfusion/knowledgebase/index.cfm?id=tn_13879Cannot Insert Layer in Editable Region Using the Layer Button (TechNote 13884).
- In Dreamweaver 3, you may have difficulty making text in an editable region an ordered or unordered list. The workaround is to specify the unordered or ordered list first, then add text.
- Inadvertently including excess tags when defining the editable region of a template can cause editing difficulties in dependent pages, so view the source after defining the editable regions of the template to be certain there are no duplicate tags. See the following TechNote for more information: Unable to insert content in editable region (TechNote 13882).
- Likewise, defining a portion of text as editable can prevent paragraphs from being created within that section in dependent documents. See the following TechNote for more information:/cfusion/knowledgebase/index.cfm?id=tn_13882What can prevent multiple paragraphs in template instances? (TechNote 14103).
This 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!
