|
|||
Using Templates for Consistent DesignDreamweaver provides two types of assets that can help you create Web pages with a consistent content and design — templates and libraries. This document describes the basics of creating and using an HTML template to an generate an identical layout for a set of pages. See also Using Libraries to Reuse or Update Page Elements.
|
|||
Designing with TemplatesA template contains locked and editable regions. The locked regions contain the fixed content you want repeated on every page. The editable regions are the areas where the variable content will be placed when you use the template to create a web page. Changing the fixed content on all pages created from a particular template is as easy as modifying the locked regions of the template. When you resave the template, all pages based on that template are automatically updated. It's then simply a matter of republishing the affected pages (or the entire site) to the web server. You can create a template from an existing page or from scratch (in a new document window). Dreamweaver gives template files the extension .dwt and places them in a folder named Templates within the local site folder. Creating a Basic HTML Template in a New Document WindowThere are a number of ways to start the template creation process. You can make appropriate selections from the File menu, the Assets panel, or the Insert toolbar. This section describes the latter method. See also "Using the Assets Panel to Work with Templates" (below). On a new, blank document page, click the Templates tab on the Insert toolbar. Click the Make Template button to save the document as a template. Then design the web page the way you want it to look, define editable regions (as described below), and save the file. Creating a Basic HTML Template From an Existing DocumentOpen the document from which you wish to create a template. Save the file as a template — File | Save As Template (or click the Make Template button on the Insert Template toolbar). Remove any content that you don't want to be part of the template (text and graphics that will change from document to document, for example), define editable regions (as described below), and then resave the file. Notes:
Designing the Page and Defining Editable Regions in a TemplateDesign your page positioning text, graphics, and links that you want to be included in all documents based on the template (locked regions) and defining areas that can be changed (editable regions). Page PropertiesSpecify page properties as you would for any web document:
Page properties will be inherited by all documents created from a template. LinksTo ensure that relative links will point to the correct files in documents created from the template, create links using the folder icon or the Point-to-File icon in the Property Inspector (i.e., do not type the link path in the link text box because it's easy to enter the wrong path by mistake). Editable RegionsEditable regions are the areas of the page that can be changed in documents based on the template. If you don't define editable regions, all areas of the web page will be "locked" in template-based documents. Locked regions are those areas that will remain the same in every document. Position the insertion point where you want to define a new editable region and click the Editable Region button on the Insert Templates toolbar. Enter a name for the region when prompted. A placeholder will be inserted into the template identifying the editable region by name. A colored rectangular outline will enclose the area (by default the outline is light yellow). Notes:
ExampleAn example of a template that contains both locked and editable regions is shown in Figure 1 (below). In this example, the layout table cells containing the University word mark, the name of the department, and links to departmental pages are locked. The cells that will contain a program name (programname) and information about the program (body) are editable. Using a TemplateYou can create new document based on a template or apply a template to an already existing document. Creating a New Document Based on a Template
When you open a new document based on a template, you'll see all template components, but the only areas you'll be able to edit are the unlocked (editable) regions (as shown in Figure 1, above). If you move the mouse over the document screen, you'll see the mouse pointer become the symbol in areas that cannot be edited. In editable areas, simply replace placeholder text with page content. Applying a Template to an Existing Document
You can undo the "Apply Template to Page" by choosing Edit | Undo Apply Template. Finding the Editable Regions of a DocumentEditable regions of a document are bordered in light yellow (by default) and labeled by name. You can simply click in an editable region and enter new material or edit existing material. In addition, the editable regions are listed at the bottom of the Modify | Templates submenu. You can use this list to select a region for editing. Modifying
a Template
|
|||
|
|||
August 14, 2003 |
Prepared by Gail Said Johnson, User Support Services |
||
ITR's technology training guides are the property of California State University, Northridge. They are intended for non-profit educational use only. Please do not use this material without citing the source. |
|||