Setting the Optional Region dialog box options

Setting the Optional Region dialog box options

The purpose of this dialog box is to create template parameters and to define conditional statements (If...else statements) for template regions. You can use simple true/false operations, or define more complex conditional statements and expressions.

In the Advanced tab you can link multiple optional regions to a named parameter. In the template-based document, both regions will show or hide as a unit. For example, you can show a "closeout" image and sales price text area for a sale item.

You can also use the Advanced tab to write a template expression (see Template expressions) that evaluates a value for the optional region and shows it or hides it based on the value.

To complete the Optional Region dialog box:

  1. In the Basics tab, enter a name for the parameter in the Name text box.
  2. Select the Show By Default checkbox to set the selected region to show in the document. Deselect it to set the default value to false.
  3. (Optional) Click the Advanced tab, then set the following options:
    • If you want to link optional region parameters, click the Advanced tab, select Use Parameter, then from the pop-up menu select the existing parameter you want to link the selected content to.
    • If you want to write a template expression to control the display of an optional region, click the Advanced tab, select Enter Expression, then enter the expression in the text box.
  4. Click OK.

When you use the Optional Region template object, Dreamweaver inserts template comments in the code. A template parameter is defined in the head section, as in the following example:

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

At the location where the optional region is inserted, code similar to the code below appears:

<!-- TemplateBeginIf cond="departmentImage" --> 
<p><img src="/images/airfare_on.gif" width="85" height="22"> </p>
<!-- TemplateEndIf --> 

You can access and edit template parameters in the template-based document (see Modifying template properties).

Related topics

  • Inserting an optional region

Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Laying Out Pages with CSS
Managing Templates
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly