Basic HTML | Site management | Assets | Library of Page Elements| Find and Replace | Templates | Style Sheets | Forms | Imagemaps | Mouseovers | Flash buttons & text | Frames | Tables: Formatting & Sorting | Preview Browsers | Font Lists | Colors | Automating Tasks | Pasting in a Script
Templates are specialized files that define the basic design of your web page. Multiple pages can be created using each template, and the pages can easily be updated when the template is changed. Templates are also used when working with Macromedia Contribute.
You create a template that looks the way you want the pages to look. Parts that you don't want to change from one page to the next are marked as 'not editable'; parts that you do want to change are 'editable'. 'Optional' and 'Repeating' areas make it possible to group multiple instances of similar fields. When you want to create a new document using that design, you create a new page with that template specified, then edit the material in the editable regions. When you make changes to the template, Dreamweaver will duplicate them on all the pages using that template.
Templates can also be used to set up starter pages, where changes can be made to all regions and/or the pages are not updated when the template is updated.
Create the template
Note: when putting a link to a particular page into a template, it's best to use a fully-qualified (http://...) address for that link. Otherwise, you may need to copy the files into the template file to have the links work properly. Graphics used in the Template should appear both in the Template folder and in the root folder of the website.
Create new pages from the template:
Repeat for all the pages you want to use that template. (Note: the pages do NOT have to have access to the template when uploaded.
When you want to be able to have multiple instances of a set of editable regions-- for instance, in a departmental directory page, where you want to have names, office locations and phone numbers for multiple people-- you can place those editable regions inside a 'Repeating Region' in the template.
First create the Repeating Region by selecting the area and choosing Insert, Template Objects, Repeating Region.
(When trying to insert the region with its paragraph, list item, table row, etc., you may need to go into the code to be sure the Region is around, not inside, the area.)
Then click inside the repeating region and insert the editable regions. You may need to insert fake characters to separate your editable regions from the edges of the repeating one, but you can remove them after the region is created:
When using the template, to create another instance of the repeating region, click on the + sign next to the name of the Repeating Region:
You can use the up and down arrows to move instances either up or down in relation to others, and the - to remove the currently selected instance.
Templates can also contain Optional regions (which are only visible if another region's value meets the requirements), editable optional regions which the user can turn on and off, Repeating tables, and attributes of particular tags can also be made editable.
Editing the Template
Notes about Templates: Templates are associated with Sites. However, Site setup does not migrate with the LAN space but has to be set up for each computer you use Dreamweaver. Templates are saved in directories with the site. So, if you put the directory you are working with in your LAN space, once you set up the Site on a computer with access to the LAN space, you will be able to use the Templates.
Adding updating dates via the template
You can combine the editable region and the date functionality to set up pages to have a last updated date that automatically updates itself whenever that particular page is updated.
Detaching a file from a template
Sometimes you may create a page with a template but not want to keep the 'template' areas sacrosanct and linked to the template. To detach the page from the template, from the Modify menu, choose Templates, then Detach from Template.
To change the template that a page uses, or apply a template to an existing page, go to the Modify menu, choose Templates, then Apply Template to Page.
Choose the template to apply.
If the region names in the new template don't match the region names in the old template-- or the page didn't previously use a template-- you will be asked which regions to put the content in:
Click on each region name and in the Move Content to New Region area, choose a region from the drop-down menu. Repeat this for all the regions that say 'Not Resolved'. Then click Ok.