Dreamweaver 8[c] The Missing Manual

17.1. Template Basics

Templates let you build pages that share a similar structure and graphic identity, quickly and without having to worry about accidentally deleting or changing elements. Templates come in very handy when you're designing a site for which other, less Dreamweaver-savvy individuals are responsible for adding new pages. If you use a template, these underlings can modify only the areas of a page that you, the godlike Dreamweaver guru, define.


Tip: Tip: Macromedia Contribute, a simple, word processorlike program for updating Web sites, works very well with sites built using Dreamweaver templates. If you build sites that are updated by people who don't know the first thing about Dreamweaver or building Web pages, Contribute can help. You can find more information about this program at Macromedia's Web site: www.macromedia.com/contribute/.

A new page based on a templatealso called a template instance , or child page looks just like the template, except that you can edit only certain areas of the page, called, logically enough, editable regions . In the example shown in Figure 17-1, one editable region includes the question-and-answer text area; the rest of the page remains untouched and is, in fact, locked.

Figure 17-1. These three Web pages are part of a section of a Web site dedicated to answering frequently asked questions. The pages each provide the answer to a different question, but are otherwise identical, sharing the same banner, navigation buttons , sidebar, and footer. This is a common scenario for Web sites that include news stories, employee profiles, product pages, or press releases. In fact, it's so common that Dreamweaver has a special featureTemplatesto help you build such pages.

A Dreamweaver template can be very basic: one or more areas of a page (the editable regions) can be changed, others can't ( locked regions ). But Dreamweaver also includes many subtle ways for controlling template instances. Here's an overview of the features you'll encounter when creating and using templates:

Furthermore, Dreamweaver can create nested templates, which inherit design elements from a master template. In this way, you can create a general unified design that's shared by other templates; this feature is described on Section 17.5.

But facilitating page creation is only one of the benefits of templates. You'll also find that templates can greatly simplify the process of updating a Web site's design. Like Library items, pages based on templates retain a reference to the original template file. Any changes made to the template pass on to all pages created from it, which can save you hours of time and trouble when it comes time to update the look or structure of your site. Imagine how much time you'll save when your boss asks you to add "just one more" button to the site's navigation bar. Instead of updating thousands of pages by hand, you need to update only a few template files.

Категории