Some of 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.

Patty Ayers
Patty Ayers
My Blogs:
The Moment (My Mexico Blog)
Making Websites
My design/administrative support business:
Ayers Virtual

<-- PAGE 2 | INTRODUCTION TO NESTED TEMPLATES | PAGE 4 -->

 

7. Open 1st_level_instance.html, if it isn't open already. Place the cursor after the text in the 2nd row and insert a table within it. Give the new table 1 row and 1 column and a width of 100%.

8. Type some text similar to what is shown in Figure 5 in the 2nd row and its nested table to help keep things straight.

9. Choose File > Save as Template to produce a new template from your 1st-level template instance. Name the new template 2nd_level_template. It should look something like Figure 5.

When you save a page which is an instance of a template as a new template, Dreamweaver automatically understands that the new template is to be nested within the first template, and produces the necessary template code.

10. Now you'll edit 2nd_level_template.dwt. Select the nested table in the second row and choose Insert panel > Templates category > Make editable region. Name the new editable region nested_table.

To continue our visual clues about editable and non-editable regions, give the second row a slightly lighter gray background (since it is editable, but only in the 1st-level template), and the nested table a white background (since it's editable in both). 2nd_level_template.dwt should now look something like Figure 5.


FIGURE 5

11. Make an instance from the 2nd-level template by going to the Assets panel's Templates category, selecting 2nd_level_template, right-clicking, and choosing New from Template. Save this instance as 2nd_level_instance.html.

12. You now have four documents: two templates, and an instance made from each template. The relationship between these documents is shown in Figure 6.


FIGURE 6

13. To see the true niftiness of nested templates, we need to put them to use by editing them and updating their linked instances.

Open 1st_level_template.dwt and edit the content in the first row; you might want to write something indicating that you're making the edit in the 1st-level template. Save the template, and when you are prompted, agree to update all instances. Notice that in the list of files to be updated are

1st_level_instance.html
2nd_level_template.dwt
2nd_level_instance.html

This is important to understand: the 2nd-level template and its instances function as instances of the 1st-level template. Check those three documents - they should all reflect the changes to the top row you just made.

 

<-- PAGE 2 | INTRODUCTION TO NESTED TEMPLATES | PAGE 4 -->

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