Adding Optional Regions

Templates provide consistent design. While consistency is generally a good thing, it can also get boring. Furthermore, there may be times when you want the flexibility to include information on some template-based pages but not on others.

Dreamweaver provides a fairly foolproof way to vary page design: optional regions. An optional region is simply part of a template you can hide or display on each template-based page (see Figure 20-9). When a page author creates a new page based on the template, she can turn the region on or off.

Creating an optional region is a snap. Just select the HTML code you wish to make optional and do one of the following:

  • On the Common category of the Insert panel (Figure 20-2), select the Optional Region option from the Templates menu.

  • Choose Insert→Template Objects→Optional Region.

  • Right-click (Control-click) the selection and choose Templates→New Optional Region from the shortcut menu.

In the New Optional Region window, type a name (Figure 20-10). Make sure not to use the same name as any other region on the page, and—although Dreamweaver lets you—don’t use spaces or other punctuation marks. (Following the rules for naming files as described on The Structure of a Website ensures that the optional region works properly.) Click OK to close the window and create the new optional region. Dreamweaver adds a light blue tab with the word “If,” followed by the name you gave the region (Figure 20-9).

Figure 20-9. Now you see it, now you don’t. ...

Get Dreamweaver CS5: The Missing Manual now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.