PATTY
SITE HOME | INTRODUCTION TO NESTED TEMPLATES
An Introduction to Dreamweaver MX Nested Templates
Donald Booth is co-author of "Inside
Dreamweaver MX" (New Riders) and works for Macromedia
Technical Support as a team lead for Dreamweaver.
If you've used Dreamweaver templates in versions 4 and earlier,
are using Dreamweaver MX, and are ready to take it to the next
level, read on!
First, we'll take a look at the type of web development situation
in which nested templates would be useful; then we'll build a very
simple example.
Bob's Fine Carpets: A Quick Example
Let's say you are building a site for Bob's Fine Carpets, Inc.
Bob has four main product lines: Persian, Indian, Tibetan, and
Antique. He wants a simple brochure web site with a main page and
a page for each of his product lines. These pages should share
a header which will be identical on each page. This is a classic
situation in which to use Dreamweaver templates, of course, and
the template could be designed as in the sketch in Figure 1.
FIGURE 1 : The 1st-level template
Remember the basic rule of templates: The
template controls the non-editable regions, and the instances
control the individual editable regions.
But Bob's line of Antique carpets needs special treatment. There
are a number of subcategories of Antique carpets, such as 19th
Century, European classic, and Early American, and Bob wants each
of those subcategories to have its own page. And he wants each
page in the Antiques section to share some identical content in
the area below the header.
Bob needs to be able to update the common Antiques content frequently,
so that all Antiques pages are updated. He'll also need to update
the site-wide header, so that the header on all pages, including
the Antiques pages, are updated.
A Job for Dreamweaver MX Nested Templates
This is definitely a job for Dreamweaver MX nested templates.
Figure 1 above shows the editable and non-editable regions in the
site-wide template. To accommodate the Antiques subcategory of
site pages, you could create a second, nested template, laid out
something like Figure 2.

FIGURE 2: The 2nd-level template
The important thing to understand here is that you would not simply
be creating two separate templates.
A nested template is created from,
and remains linked by template code to, the first template. A
nested template functions much like an instance of its parent
template, inheriting any changes made to the parent.
When Bob needs to change his photograph in the page header, this
change would need to happen on all of the site pages,
so he would make the change to the first template and allow it
to propagate to all the instances, or child pages - including
pages made both from the first template, and those made directly
from the second template.
But when he needs to change the general definition of "Antique
carpets"
on only the Antique carpet pages, he would make that change to
the second template, and it would propagate to only the pages made
from the second template.
INTRODUCTION TO NESTED TEMPLATES
| PAGE 2 --> |