Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Date Date
Qty:
Subtotal
Promotions
Estimated Shipping
VAT
Calculated at checkout
Total
Checkout
Dreamweaver Help / 

New template features in Dreamweaver MX

Adobe Community Help


Products Affected

  • Dreamweaver

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 

Macromedia Dreamweaver MX introduced many new features for templates. With these new features, you can create templates that allow a great deal of control over page editing. With the advent of optional regions, repeat regions and nested templates, you can create complex, almost dynamic pages.

This TechNote will review the template features introduced in Dreamweaver MX.

Nested Templates

Nested templates are essentially templates within templates. This feature allows different levels of control on pages created from these templates.

The benefits of nested templates

Nested templates can help developers in a number of ways, but the common thread among all uses is to provide two differing levels of control and editability. A common scenario in which nested templates is useful is for a website that has a single overall appearance (the company logo and contact information, for example). But the website also has sections that use a distinct appearance. For the separate sections of your web site, you can make nested templates that will have common elements and layout features for that section.

This helps you as a developer because if you need to change your address or logo, you need to merely change it in the parent template file and it will automatically update all the pages. If your Products section develops a new look, however, you simply have to update the nested template (otherwise known as the child template), and those changes will only propagate through the Products pages.

How to create nested templates

Note: This topic is described in greater detail in Creating a nested template in Dreamweaver MX (TechNote 16282). This section just provides an overview of the method used for creating nested templates.

  1. Create a normal template, the same as in previous versions of Dreamweaver. This template will act as the parent template. There must be at least one editable region in the template.
  2. Make a page from this template. As usual, you will only be able to add new content to the editable area(s). The rest of the page will be locked. This template will now act as the nested;or child;template. Add content to the editable area(s). You can add images, text or any other web element.
  3. In this second template, add a new editable area within the existing editable area. This will convert the page from an instance of a template into a nested template.
  4. Save this file as a template.

To see the differences between the two templates, make a page based on this nested template. As expected, you will only be able to edit the content defined as editable regions in the nested template. When you make a change to the nested template, only pages based on the nested template will update. When you make a change to the original template, any pages based on the parent template;including the nested template itself;will update. Since the nested template is updated by changes in the parent template, all pages based on the nested template will update, too.

Note: An example of the template attributes discussed below can be found in the example code provided at the bottom of this page. All code examples in this TechNote are taken from this sample file.

Repeat Regions

The template repeat regions feature allows developers to create a template without knowing how many instances of a certain element will be needed. This allows developers to control the appearance of a specific element, yet the template users can freely repeat that specific element, changing the content in the element as appropriate.

The benefits of repeat regions

Developers are most likely to use repeating regions in conjunction with tables. If your template contains a table, you can set a row or group of rows to be a repeating region. You might then define an editable region within the repeating region (so in the example of a table, at least one table cell will contain an editable region). When a user makes a page based on that template, the user will be able to add a new row or group of rows, adding distinct content into the editable table cells. The template itself will have only one row (or group of rows), yet pages based on the template can have as many rows as is needed to display the information. The template user can add and subtract rows and move the rows up and down within the repeating rows. This is a good way to give developers flexibility for expanding pages as the site grows without disturbing the underlying templates.



This is such a popular way of using a repeat region that Dreamweaver has a template object called Repeating Table. This object allows you to set up the table and repeat region within the same dialog box.

How to create repeating regions

Note: This topic is described in greater detail in the help documentation. This section just provides an overview of the method used for creating repeating regions.

  1. Open or create a new template.
  2. Choose the content that you want to repeat. This can be a bunch of text, an image, etc.
  3. Choose Insert > Template Objects > Repeating Region.
  4. Name the repeat region with a name that does not include spaces or unusual characters, and click OK.
  5. Optional: Select content within the newly defined repeat region and make it editable by choosing Insert > Template Objects > Editable Objects.
  6. Save the template file.
  7. Create a new file from this template, and note that the content is available. As shown in the image above, there will be a plus and minus icon to allow you to add and remove an instance of the repeat region, and the up and down arrow icons allow you to resort the regions.

Remember that depending on how you define the repeating regions, you may not really need the repeating region. An example of a situation in which a repeating region is uniquely suited is if you insert an image, and make it a repeat region but not editable. In a document based on this template, the image object can be repeated as necessary simply with a click of the plus icon.

How to create repeating tables

Note: This topic is described in greater detail in the help documentation. This section just provides an overview of the method used for creating repeating tables. It is also important to note that the repeating table is merely a specialized use of a repeating region.

  1. Open or create a new template.
  2. Choose Insert > Template Objects > Repeating Table.
  3. Within the Repeating Table dialog box, enter the settings you want for your table, then specify which row should be repeated. The Ending Row setting will help determine how many rows will be repeated, and must also be filled. If you want only the first row to be repeated, you would enter 1 in both the Starting and Ending Row text boxes.
  4. Click OK. Each of the cells in the row will automatically be defined as editable, which means template users will be able to add content into each of those cells.

Optional Regions/Template Parameters

Optional regions are just that: optional. Optional regions define content or editable regions that can be turned on or off (be visible or not).

The benefits of optional regions

The usage of optional regions can range from simple to complex, and more complex usages will require forethought and scripting capabilities.

A simple use of an optional region is to allow content to either be visible or not in a page based on the template. The content defined as an optional region is added in the template. A template user who makes a template with an optional region can then decide whether or not to retain the optional region. If the user turns the optional region off, the content defined as the optional region will no longer appear on the page. This may be useful in a situation where the template developer wants to control the placement and appearance of a bit of content, yet the developer also wants template users to choose whether or not to use that bit of content.

More complex usages of optional regions allow parameters to determine whether or not the optional region will appear. So, instead of the template user choosing to toggle the optional region, the optional region will toggle on or off in reaction to a parameter.

Creating alternate table row colors is an example of a more complex usage of optional regions. If you have a repeating table (such as the one discussed and displayed above), the developer is unable to change the appearance of the table rows since they are locked down by the template. Dreamweaver can keep track of the number of rows in a table, however. You can therefore set up an parameter within the template that tracks the number of rows. The optional region can be defined to toggle on or off in response to the row number.

How to create and implement optional regions

Note: This topic is described in greater detail in the help documentation. This section just provides an overview of the method used for creating and implementing optional regions. This section will also give some general information about creating and using template parameters, but it is beyond the scope of this TechNote to give precise instructions for creating template parameters.

Create the optional region in the template file:

  1. Open or create a new template file.
  2. Add some content (text or a graphic, for example) to the template page and select it.
  3. Choose Insert > Template Objects > Optional Region.



    Note: If you want the template users to be able to add or edit the content contained within the optional region, choose Editable Optional Region. Doing so will add a region next to the content you have added (not surrounding the content).
  4. The New Optional Region dialog box contains two tabs: Basic and Advanced. To create a simple optional region;an optional region that template users can toggle themselves;enter a name for the region in the Basic tab and click OK.
  5. Save the template.

Toggle the optional region in a file based on the template file:

  1. Create a new file from the template.
  2. Choose Modify > Template Properties.
  3. The optional region you defined above is listed in the Template Properties dialog box. Select the name of the optional region. By default, the optional region will be set to show, so the value for the optional region is True.
  4. Turn off the optional region by clicking the Show<OptionalRegionName> option. Choose OK.

You can create template parameters manually in the code of the template file, but template parameters are also created automatically when you create an optional region as described above. In any case, all template parameters must be written in the head of the document and must follow the syntax shown below (replace <custom> with customized values).

<!-- TemplateParam name="<custom>" type="<custom>" value="<custom>" -->

When you create an optional region using the method described above, the template parameter is written specifically as follows:

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

While in the template file, you can create an optional region that uses a template parameter by using the Advanced tab of the New Optional Region dialog box:

  • Use Parameter: You can create an optional region that uses a pre-existing template parameter IF the template parameter is a boolean type with a value of either true or false. Any parameters that meet that specification will be available in this pop-up menu.
  • Enter Expression: Essentially, once you have created a template parameter, the parameter can be used as would any other parameter in JavaScript. In fact, template expressions are based on JavaScript coding rules, so the syntax is identical to JavaScript coding. You can use mathematical functions to add, subtract, multiply or divide parameters to added complexity.

You can also create an optional region that uses a template parameter directly within the code. How you code these regions depends on where in the code you are using them.

  • A region that uses a template parameter can be expressed as a variable. This is the more flexible choice since it can be used to replace a value of a tag's attribute, and it can also be used as a placeholder for the content. You use the syntax below if expressing the parameter as a variable (replace <parameter> with the name of a defined template parameter):

    @@("<parameter>")@@

  • A region that uses a template parameter can be expressed as a tag. The Template Expression tag is set off as an HTML comment, but it otherwise acts as a tag in that it has a single attribute and a value. This method can not be used to replace a value of a tag's attribute, since it is a tag itself. The Template Expression tag is coded as below (replace <parameter> with the name of a defined template parameter):

    <!-- TemplateExpr expr="<parameter>" -->

In both cases, Dreamweaver recognizes the code and will replace the code with the value of the parameter in any page based on this template. To get a sense of how they differ, though, the following examples highlight how to use them.

Example 1: In this example, either method of hand coding an optional region (highlighted in red) will work, because the code is not used to replace the value of a tag's attribute. In both cases, Dreamweaver will see this code in any page based on this template, and will replace the code with the actual defined value (the value will be editable for template users by modifying template properties):

  • Works:<title>@@("title")@@</title>
  • Works:<title><!-- TemplateExpr expr="title" --></title>

Example 2: In this example, the method of hand coding that uses a Template Expression tag is incorrect, because the code IS used to replace the value of tag's attribute. For the first method, though, Dreamweaver will see this code in any page based on this template, and will replace the code with the actual defined value (the value will be editable for template users by modifying template properties). For both methods, the code that attempts to describe the parameter is highlighted in red:

  • Works:<table border=@@("border")@@ cellpadding=3 cellspacing=0>
  • Does not work:<table border=<!-- TemplateExpr expr="border" --> cellpadding=3 cellspacing=0>

Editable Attributes

Sometimes you want to allow your template users to adjust some specific aspects of the page, but not have access to all of the code for the element. Editable attributes can be the answer for this. Editable attributes allow the template users to change specific attributes of a tag, without having access to the tag itself.

Note: Editable attributes are a specialized use of an optional region. Essentially, adding an editable attribute is the same as defining that tag's attribute as an optional region. This feature creates a template parameter, for which the template creator can define a default value, and the template users can modify the parameter value as they would modify any other optional region's parameter value.

The benefits of editable attributes

In HTML, attributes are details assigned to tags. For example, a table tag may have a bgcolor attribute, which defines the background color of the table. Typically, if a template developer wanted template users to be able to modify things like the background color of a table, the developer would have to allow the entire table to be editable (so in the case of a table, the table would actually have to be added into an editable region). By using an editable attribute, however, the developer can add the table, set only table cells to be editable regions, and define the background color;the bgcolor attribute;to be an editable attribute. In a page based on such a template, the user will not be able to modify the table itself, but can change the bgcolor attribute and add or edit any content in editable regions within the cells of the table.

How to create editable attributes

Editable attributes are defined by the template developer.

  1. Open or create a new template file.
  2. Add content to the page. For example, for the table example, insert a table on the page. Whatever you add to your page, it has to be contained in a tag (so text itself wouldn't work, but text contained in a paragraph tag would).
  3. Select the tag whose attribute you want to enable. In the case of the table, select the table and define a background color for it. You can also skip this step and type the name of the attribute in step 5, but that requires knowing the name of the attribute.
  4. With the object still selected, choose Modify > Templates> Make Attribute Editable. The Editable Tag Attributes dialog box appears:


  5. Choose the attribute you wish to make editable from the Attributes pop-up menu. If you did not already set the attribute in step 2, click the Add button and type the name of a valid attribute. Important: The attribute must be a valid attribute for the tag.
  6. Check the Make Attribute Editable option.
  7. Type a name for this editable attribute. Dreamweaver will provide one automatically, but it is wise to type a name that you know will be unique. Remember, the template users will have to recognize this name from a list when choosing to define this attribute.
  8. If you choose to make editable an attribute that was already defined, then Dreamweaver should choose the Type setting for you. If you added an attribute name in step 5, then you will have to choose the appropriate type from the pop-up menu. Verify this setting is correct for the data, since template users will have different methods of choosing their value depending on this setting. The choices are:
    • Text: This is appropriate for a value that requires text. An example is the align attribute for a table tag. The template user will get a text box in which to enter the replacement text.
    • URL: This is appropriate for describing the path to a file. An example is the source (src) attribute for an image (img) tag. The template user will get a text box as well as a folder icon to allow them to browse to the file.
    • Color: This is appropriate for setting a color. An example is the background color (bgcolor) for a table tag. The template user will get a text box as well as a color picker to choose the color.
    • True/False: This is appropriate for an attribute that toggles on or off. An example is the nowrap attribute for a table cell tag. The template user will get a pop-up menu from which to choose either true or false.
    • Number: This is appropriate for an attribute that requires a number. An example is the width value for a table tag. The template user will get a text box in which to enter the replacement number.
  9. Define a default value for the attribute.
  10. Click OK.
  11. Create a new page from this template, and choose Modify > Template Properties. A list of editable attributes will be listed in the dialog box. Optional regions are also in this dialog box. Select the attribute you want to edit and set the value in the dialog. Click OK and the new value will be set on the page.

Additional template features

Removing Template Regions

To remove an editable area or other template region, highlight the region in question and choose Modify > Templates > Remove Template Markup.

Check Template Syntax

Another feature in Dreamweaver is the ability to verify that your template code is correct. With the added complexity and hand coding needed for some template expressions and parameters, there is a bigger opportunity for coding errors. Using the Check Template Syntax Command will help you debug your code.

This feature can only be used in the actual template file. Choose Modify > Templates > Check Template Syntax.

Example code

This example code contains editable regions within a repeat region. To use the example code, follow these instructions:

  1. In Dreamweaver, create a new HTML Template (File > New > Template Page > HTML Template).
  2. Save this file as a template within a defined site by choosing File > Save as Template, choosing the site from the Site list, and naming the file.
  3. Within the browser window, select the example code from below and choose Edit > Copy.
  4. Switch back to the template file in Dreamweaver.
  5. Select all code in the template file (switch to Code View, and choose Edit > Select All) and paste the copied code by choosing Edit > Paste.
  6. Save the template by choosing File > Save.
  7. Make a page based on this template by choosing File > New> Templates, and selecting the template from the appropriate site. To use the repeating region feature, choose Modify > Templates > Repeating Entries, and add a new entry. These colors can be modified within the instance of the template by choosing Modify > Template Properties.

The template contains:

  • an editable attribute.
  • expressions
  • editable regions
  • repeat region
  • Template parameters

<html>

<head>

<title><!-- TemplateExpr expr="title" --></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="" content="This example is based an a template created by Wanda Huang.">

<!-- TemplateParam name="title" type="text" value="Using Repeat Region Variables in Expressions" -->

<!-- TemplateParam name="border" type="number" value="1" -->

<!-- TemplateParam name="evenColor" type="color" value="FFFFFF" -->

<!-- TemplateParam name="oddColor" type="color" value="#CCCCCC" -->

</head>

<body text="#000000">

<table border=@@("border")@@ cellpadding=3 cellspacing=0>

<tr>

<th >Name</th>

<th>email address</th>

<th>phone</th>

</tr>

<!-- TemplateBeginRepeat name="Parent" -->

<tr >

<TD><!-- TemplateExpr expr="_index+1" --></TD>

<TD><!-- TemplateBeginEditable name="email" -->email<!-- TemplateEndEditable --><br>

</TD>

<TD><!-- TemplateBeginEditable name="phone" -->phone<!-- TemplateEndEditable --></TD>

</tr>

<!-- TemplateEndRepeat -->

</table>

</body>

</html>

Additional information

For more information about the new Dreamweaver MX template features, check the Using Templates section of the Dreamweaver Support Center.

For more information about creating nested templates, seeCreating a nested template in Dreamweaver MX (TechNote 16282).

Keywords: tn_16347

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement