DM 171: Week Seven - Template Basics

Template Basics

Dreamweaver templates are one of the program’s strengths; generating consistent pages to populate your site along with their ease of site wide modifications make templates a valuable production tool. In work groups; templates limit the areas that your content providers may edit thereby preserving your code for the structure of the page.

Click on a tab to reveal its content…

  • Editable Regions
  • Optional Regions
  • Repeating Regions
  • Editable Attributes

Editable region selection from the common toolbarWhen you choose to convert a page into a Dreamweaver template, Dreamweaver locks down the entire page. You must then select regions of the template and convert them into editable regions. This allows the content to change as you generate each page.

The screen shot to the right shows the editable region menu on the common toolbar. You may also use menus: Insert > Template Objects > Editable Region. Check your version of Dreamweaver for the keystroke commands.

Dreamweaver common toolbar insert optional regionOptional regions are one that you may or may not want generated when you use a template. Use Optional Region for an area that is not editable by the template user such as contextually based part of the navigation, an optional side column of RSS feeds, and so on.

Dreamweaver common toolbar optional editable region buttonIf you need an optional region that the template user may edit, choose Editable Optional Region. This could be used for optional pull quotes on a book review site, optional product images on a commerce site, and so on.

With either of these choices, you are presented (under the basic tab) to show the region by default or not. The advance tab gives other options for choosing if the region is shown.

The template user may choose to show or hide the region by using the menu: Modify > Template Properties… where the option is available.

Dreamweaver inserts in the head section, the value of true if the region is initially shown and false if hidden:

<!-- TemplateParam name="name_you_chose_for_region" type="boolean" value="true" -->

And where you want to place the optional region:

<!-- TemplateBeginIf cond="name_you_chose_for_region" -->
The Optional Content
<!-- TemplateEndIf -->


Dreamweaver common toolbar insert repeating region button Repeating regions allow your template user to add (or reorder/subtract) regions of the page you want to repeat. A very common usage would be a repeating table row with cells for product image, description, and price.

A repeating region is not in itself and editable region. For the example above, the designer would need to add editable regions inside of the cells so that their content may be changed.

Since repeating table rows are such a popular option, Dreamweaver has included a Repeating Table along with the other choices. It brings up its own dedicated dialog box to set up the table.

Dreamweaver also allows the designer to make specific (x)HTML tag attributes editable.

Dreamweaver menu: Modify Template Make Attribute Editable...Select the element in the template that needs the editable attribute. In the top menu, choose: Modify > Templates > Make Attribute Editable…

The resulting dialog box allows the designer to choose any of the tag’s attributes and allows them to be editable, either manually or automatically.

A handy use is to make the class attribute of your template’s body tag editable so you can change it to affect the “here” state of the navigation.