Optional Regions

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter 8.  Dreamweaver Templates


An optional region is more or less a region that can be shown or hidden. This functionality can be determined either by the template author or the template user.

You can create an optional region in two ways: you can create it in the code view or you can create it in the Optional Region dialog box. The code you insert is a comment within the <head> portion of the HTML.

 <!-- TemplateParam name="Name Something" type="Boolean" value ="false" -->  

Code is also inserted into the area where you want the optional region to be placed. It looks something like this:

 <!-- TemplateBeginIf cond="Name Something" -- >  <p><Content you wish to show or hide></p> <!-- TemplateEndIf -- > 

Of course, you would substitute "Name Something" with a name that makes more sense for the region, and you would actually have HTML that would add content to the document between the <p> paragraph tags.

Of course, this is Dreamweaver's WYSIWYG HTML editor, so you may just want to set it up through the dialog box. There is generally less room for error that way. To insert an optional region in a template, follow these steps:

  1. Open a template by double-clicking it in the Assets panel.

  2. In the document, select the item you want to make an optional region.

  3. With the item selected, choose Modify, Template Objects, Optional Region. You also can click the Optional Region button in the Insert panel under the Templates tab or contextual-click the object and in the context menu, choose Optional Region. This will open the New Optional Region dialog box, as shown in Figure 8.12.

    Figure 8.12. The New Optional Region dialog box offers the options of creating statements to either hide or display the selected region.

    graphics/08fig12.jpg

  4. With the Basic tab selected, type in a name for the optional region. It's important to name this region something that will make sense to you later on. You will have to refer to this region by this name in a template-based document.

  5. If you want the region to appear, leave the Show by Default option selected; if not, uncheck that option. The user of the template will have the option of changing this value by selecting Modify, Template Properties. In the Template Properties dialog box, the user has the option of hiding or showing the optional area, as shown in Figure 8.13.

    Figure 8.13. This dialog box offers options for updating pages both with library items and templates.

    graphics/08fig13.jpg

  6. When you're happy with the settings, choose OK.

There is also an Advanced tab in the Optional Region dialog box. The reason is so you can write your own expressions to add functionality and options to the optional region. The template expression language is a small subset of JavaScript and uses JavaScript syntax and precedence rules.


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net