CREATING A TEMPLATE TO CONTROL DESIGN & CONTENT

Templates in Dreamweaver are a lot like master pages in InDesign; you create the content you want to appear on all the pages in your site in a template, and then create an element whose content will change from page to page.

Any portions that you don’t define as “editable” can’t be changed on individual pages, but if you change the template itself, all the pages that use it will update to reflect those changes. This can be mighty handy if you’ve got a bad link in a nav bar, for instance. Fix the link in the template, and avoid having to change it on every page in your site.

HTML documents created using a template are referred to as “child” pages, with the template being the “parent.”

 

   

Begin by creating a template page. Select “new” from the File menu and from the general tab, select “template page” and “HTML template.”

 

   

Insert or create anything that will be common to all the pages in your site—this could include background images or textures, banners, nav bars, and so on. You could even assign CSS styles to your template page.

Then create an area—either layers, or a table—that will contain content that changes from page to page.

If you’re using layers, click in each one and from the common tab of the insert panel, choose “editable region.” Name each one with a unique name so you remember what goes where (or so someone else who may be using it knows).

If you’re using a tables, select each one and make it editable. The keystroke shortcut is command option V.

Dreamweaver will ask you to name each region. It’s also not a bad idea to put some descriptive text into each area so when you’re creating new pages from the template, you remember what’s supposed to go where.

Save your template when you’re done.

 

 

make template

 

Once you’ve created and saved a template, it’s given a suffix of .dwt and stored in a “templates” folder that Dreamweaver automatically creates in your site folder. Don’t move the folder or the files or Dreamweaver will loose track of them.

To create a new page using the template, select “new” from the file menu. In the dialog box that opens, click on the “template” tab at the top. If necessary, navigate your way to the templates folder inside your site folder and select the template you want to use.

Note at the bottom right is the option to update all pages that use this template whenever the template changes. I’d leave this checked.

 

 

Your new document contains any content you placed or created in the template, plus the editable regions where you can add text and/or images.

If you try to mess with anything you didn’t define as “editable” you get a “not allowed” icon.

 

 

f you find you need to edit the template itself, open it by choosing Modify > templates > open attached template, or “open” from the File menu, and navigating your way to the templates folder in your site folder or disk.

Saving an edited template triggers a dialog box that asks you if you want to update any pages that use that template.

When you click “update” another window opens and shows you which files were updated.
Very nice.

 

 

update pages

update

 

If you find you need to edit a Fireworks banner or nav bar that's used in a template, make sure to use the "edit from Fireworks" button from within Dreamweaver: if you edit the original and try to replace it in the template, lots of weird things happen.