Modifying a Template


Templates give you tons of control over what can be edited and what can't. Sure, that's important. But what happens if you make lots of pages from your template and then something changes? Maybe you need to add a new item to the menu, or you need a new editable region on the page. The answer is that something really cool happens when a Dreamweaver template is modified: Dreamweaver automatically changes all the pages you've already made using that template. So you can make changes to just one page (the template) and have those changes automatically ripple through the site.

Normally, you'd start your modification directly in the template file. But you can also start from any document that is attached to the template. You can pick and choose the attached pages to which you want the changes to apply.

To modify a template file:

1.
In the Assets panel, click the Templates button to display the templates, then double-click the template file you want to edit.

or

In the Assets panel, click the Templates button to display the templates, then highlight the template file and click the Edit button at the bottom of the panel.

The template file opens in the document window.

2.
Edit as desired, then choose File > Save, or press Ctrl-S (Cmd-S).

The Update Template Files dialog appears. Each file attached to the template is listed in the dialog ( Figure 13.11 ).

Figure 13.11. Here's the powerful part of using templates. Dreamweaver offers to update template-based pages when you change a template.


If you click Update , every file attached to the template will update. If you click Don't Update , none of the files attached to the template will update.

You can't choose to modify just one page here (it's all or nothing), but it's possible to do that elsewhere. See the section below, "To modify an individual template-based page" for details.

3.
Click Update.

The Update Pages dialog appears ( Figure 13.12 ). Dreamweaver sorts through all the files in your site and makes the updates, showing you the progress in the Update Pages dialog.

Figure 13.12. If you allow Dreamweaver to update template-based pages, it reports the results when it's finished.


This dialog also allows you to update all the pages in the site to their corresponding templates, or just update files based on a specific template. If you don't need any additional updates than the ones Dreamweaver already made, go to Step 7.

4.
(Optional) From the "Look in" pop-up menu, choose Entire Site or Files That Use.

The first choice reapplies all the templates in the site to files made from those templates. The second choice, which is what you will want to do most of the time, just updates the pages based on the template you just edited.

When you make a choice from the "Look in" pop-up menu, the inactive Done button becomes active, and its label changes to Start.

5.
(Optional) Make sure that the Templates check box is selected.

6.
(Optional) Click Start.

When the process is complete, the Start button changes to Done and becomes inactive.

7.
Click Close to dismiss the Update Pages dialog.

8.
Close the template file.

To modify a template attached to a current document:

1.
With a document based on a template open, choose Modify > Templates > Open Attached Template.

The template opens in a separate window.

2.
Make your modifications as described in the previous section.

When you save the template, you'll be prompted to update pages attached to that template, including the page you started with.

To modify an individual template-based page:

1.
Change a template file as described above. In the Update Template Files dialog (Figure 13.11), click Don't Update.

2.
Open a document attached to the same template.

3.
Choose Modify > Templates > Update Current Page.

The page updates with the changes you made to the template. No other pages in the site will update.

Tips

  • When your template links to a CSS file, all your template-based pages link to it as well. If you change your CSS rules, the pages created from the template will automatically reflect those changes in exactly the same way non-template-based pages reflect CSS changes.

  • HTML pages changed by the update of a template file need to be uploaded to the server for the change to be visible to your site's visitors . The easiest way to do this is to synchronize the local and remote sites. See "Synchronizing the Local and Remote Sites" in Chapter 2 for more information.





Macromedia Dreamweaver 8 for Windows & Macintosh Visual QuickStart Guide
Macromedia Dreamweaver 8 for Windows & Macintosh
ISBN: 0321350278
EAN: 2147483647
Year: 2005
Pages: 239

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net