The idea behind a template, as we create earlier in class, is to make it easier to create pages. A template should help you:
- Reduce page development time
- Increase consistency between pages
However, the problem with the old method of using a “template” file, renaming it, and adding new content is that it will be difficult to update pages based off the template
Dreamweaver has come up with a work around for it. A Dreamweaver Template that solves some of the common “template” problems.
Dreamweaver Templates works on the same principle as the templates we create, but it has a couple of advantages!
Dreamweaver tracks all files created from the template. Dreamweaver allows files to be modified by the template, after they are created. So when a template is updated, all of the files based off the template are also updated.
Dreamweaver also allows you to lock down areas of the page so they can’t be modified – this increases consistency between pages.
How to Make a Dreamweaver Template
Use these steps to create a template.
- Open your “template” file from before
- Choose the section which will change, delete any filler text
- Insert > Template Objects > Editable Region
- Save – this will automatically save as a template. A new/special save window will open. Use this to save your template.
Once you have created a template, only save the document. NEVER use Save As, as this can lead to problems later on.
How Many Templates do You Need
Generally you should need only 1 template per web site. In some instance 2 is acceptable, but rarely would you have more. Of course unless you have a massive site with lots of different “areas”.
I sometimes see people try to create a template for every page. This wouldn’t make laying out/building or maintaining your site any faster, so avoid this at all cost. The most I ever had is 4, and that was a very special case, where I constantly questioned myself if I had too many.
Templates work great when you have more than 5 or 6 pages to work with, up to 25-75, depending upon the site. So you shouldn’t have a template if your website is only 1 or 2 pages.
To Create File from Template
Of course you will need to create files from a template. To do so, follow these instructions:
- File > New
- New Page from Template Tab (far left category)
- Select Site (the site you are in is selected by default)
- Select the Template to create the new page from (you should only have one choice in many cases)
- Save your File as an HTML document