Dreamweaver 8 Design and Construction (OReilly Digital Studio)

11.4. Applying the Template to an Existing Page

Your template file and the index.html page are now two separate documents. To associate index.html with the template, so that the home page receives automatic updates when you edit the content in the template, you must now apply the template to the home page.

To do this, go to the Files panel, and doubleclick index.html. Dreamweaver opens the home page in a new document window. (You don't need to close the template's document window, although you can if you want.) Then, from the main menu, choose Modify Templates Apply Template To Page. The Select Template dialog box shown in Figure 11-14 appears. Click the name of the template that you want to apply, and then click Select.

TIP

On the Select Template dialog box, make sure that you check the option for updating the page when the template changes. Otherwise, when you change the content of the template document, Dreamweaver will keep the old template content on this particular page of your site.

Figure 11-14. Select the template to apply

Figure 11-15. Choose what to do with the existing content of the page

In all likelihood, you receive the Inconsistent Region Names dialog box shown in Figure 11-15, which simply means that Dreamweaver isn't sure what to do with the existing content of the home page. It's up to you to explain to Dreamweaver how to handle each inconsistent item, by moving, deleting, replacing, or ignoring it.

  • You should replace the current document body content. Select Document Body from the dialog box, and choose Nowhere from the menu.

  • You should move the current head content to the appropriate editable region. Select Document Head from the dialog box, and choose Head from the menu.

BEHIND THE SCENES

You don't remember adding an editable region called head because you didn't add this region! Dreamweaver did it for you automatically when you created your template.

Click OK, and Dreamweaver applies the template to your home page, as Figure 11-16 shows.

Figure 11-16. Dreamweaver applies the template to the home page

Move the mouse pointer over the layout, and notice that the pointer turns into a "no" sign when you hover over any non-editable region. This is permanent, template-con-trolled contentyou can still change it, of course, but you must change it in the template document itself.

Choose File Save from the main menu to save your changes to the home page.

Категории