Creating a Template


Templates are perfect for many situations. For example, let's say you have a large site where many different individuals change content and add pages. Using a template provides control over the page layout and design by restricting changes only to certain editable regions on a page. Other areas on the page are locked regions , which can't be changed by people working on an individual page. Locked regions can only be edited in the original template file. This kind of control guarantees a consistent look and feel for a site, and prevents any accidental changes to locked regions.

When a change is made to a template, every page made from, or attached to, the template is automatically updated throughout the entire site. You can create a template from scratch, but it is simpler to use an existing page as a model for the template, and that's what we'll explain here.

Before you save a document as a template, make sure you've already included any needed <meta> tags, style sheets, behaviors, or other underlying parameters. These page elements are located in the locked regions of a template. There's no way to add things like style sheet links to individual pages made from a templatethey must exist in the template already.

To create a template from an existing page:

1.
Open the document you want to turn into a template.

2.
Choose File > Save as Template.

or

Choose Make Template from the Templates pop-up menu of the Common category of the Insert Bar ( Figure 13.1 ).

Figure 13.1. The pop-up menu for the Template icon in the Common category of the Insert Bar covers the basic commands you'll need.


The Save As Template dialog appears, with the Site pop-up menu set to the current local site ( Figure 13.2 ).

Figure 13.2. Any page can be saved as a template. The name you type in the Save as field will be followed by the file extension .dwt in the Assets list.


3.
Enter the requested information in this dialog.

  • Existing templates: You don't enter anything in this field. Dreamweaver lists any existing templates for the site automatically.

  • Description: Type a brief description of the template.

  • Save as: Type the name of the template.

4.
Click Save.

If it doesn't already exist, Dreamweaver adds a Templates folder to your site files. Your new template will be inside this folder, with the file extension .dwt , indicating that the document is a Dreamweaver template.

Tips

  • Templates are for local use; they're never loaded in a browser. The Templates folder and its .dwt files don't need to be uploaded to the server. Just upload the individual HTML pages made from the template. To make this easier, you can cloak the Templates folder, which prevents Dreamweaver from uploading it to the remote server. See "Cloaking Files," in Chapter 2, for more information.

  • It's possible to create a template from scratch. Choose File > New and select Template Page in the New Document window. Or you can start one using the New Template button in the Templates area of the Assets panel.





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