The tutorials and articles on this site are somewhat dated, but I've kept them here because they still have value for some Dreamweaver users. I hope to add new material before long.

Patty Ayers
Patty Ayers

<-- PAGE 1 | INTRODUCTION TO NESTED TEMPLATES | PAGE 3 -->

Template Relationships

Nested templates work in a hierarchical model, and changes made to them flow logically from their relationship in the hierarchy. Figure 3 shows the relationship between the templates and instances in Bob's web site.


FIGURE 3

The easiest way to understand nested templates is to build a set and try them out. We're going to use an example which is much more basic than the Bob's Fine Carpets site, simply so that you can build the pages and templates more quickly, but the principles are exactly the same.

We'll be creating a first-level template and a nested second-level template. We'll make instances (or child pages) from each, and see how changes to each of the templates affect the instances. In this tutorial, you're only instructed to create one instance from each template, again, for simplicity's sake; naturally, in a real-life application there would be multiple instances from each template.

A Quick Walk-Through

1. Open a new file in DMX; don't save it yet. (You'll see why in a moment.)

2. Add a one-column, two-row table to the page, giving it a width of 75% and a border of 1.

3. Type in text in the rows, indicating that the top row is non-editable, and the second row editable. Give the top row a grey background color; we'll use that grey color to indicate a non-editable region.

4. Select the second-row <td> and make it an editable region by choosing Insert panel > Templates category > Make editable region. Name the region 2nd_row.

4. Now save the page as a template, naming it 1st_level_template (Dreamweaver will add the file extension .dwt). It should look something like Figure 4.


FIGURE 4

5. Press F11 to open the Assets panel, choose the Templates category, right-click on 1st_level_template and choose New From Template. This creates an instance of the template. Save the new document as 1st_level_instance.html.

6. You now have a template and an instance. In the instance, you can freely edit the content in the second row, but you can't change the content in the first row. You could conceivably make many more instances from the 1st-level template; all would have the exact same content in the first row, and would have editable 2nd rows.

This is all normal non-nested template behavior. Now let's see what nested templates can do.

 

<-- PAGE 1 | INTRODUCTION TO NESTED TEMPLATES | PAGE 3 -->

Copyright © 2004-2007 Patty Ayers · All Rights Reserved
Contact Us