Dreamweaver Template Tips

by James Cook on October 17, 2010

Templates (.dwt files) add important and powerful functionality to Dreamweaver by allowing you to:

  • Quickly create multiple pages sharing a common layout.
  • Easily update multiple pages based upon a template by editing the template.

Unfortunately, novice users often fail to implement templates correctly causing themselves a lot of frustration and extra work rather than saving time and effort. Most of the problems stem from a misunderstanding of the basic concepts governing templates and a few common mistakes. Here is what you need to understand to get started with templates.

  1. Define/Setup your site correctly: Templates will not function properly unless you have correctly set up your local site in the Site Definition/Site Setup (CS5) dialog.

Dreamweaver New Document Dialog

  1. Create templates correctly: You create a new template by:
    1. Dreamweaver New File MenuSelecting the File>New… menu command.
      1. i.     Choosing the Blank Template option in the New Document dialog.
      2. ii.     Choosing the appropriate Page Type and Layout options.
      3. iii.     Clicking the Create button.
    2. Or, with an existing page open, Choose the File>Save as Template… menu option.
  2. The Templates folder is sacred: When you create a template, Dreamweaver will automatically save it into the Templates folder in the root folder of your site (if the Templates folder doesn’t exist, DW will create it). Moving the template or renaming the Templates file will break the template. Also, avoid saving any files other than templates in the Templates folder.
  3. Understand editable regions:
    1. Editable regions are editable on pages created from a template.
    2. Editing an editable region in a template (.dwt) file will have no effect on pages created from that template.
    3. Every template needs at least one editable region. Otherwise it’s only useful for creating duplicate pages (which really isn’t useful at all).
  4. Understand non-editable regions:
    1. Non-editable regions are locked on pages created from a template.
    2. After editing a non-editable region in a template (.dwt) file, you will have the option of updating pages created from the template when the file is saved.
    3. Areas of a template not specifically defined as editable are non-editable.
  5. Upload all pages linked to the edited Template: Uploading an edited template doesn't update your site. You must upload all the pages that were updated when you saved the template to see the changes online. Remember, templates and the files created from them are linked only in Dreamweaver so just uploading an edited template hasno effect on your live site.
  6. Template (.dwt) files aren’t part of your site: Template files are tools for use within Dreamweaver. It is not necessary to upload them to the server for your site to function properly.
  7. Upload the template (.dwt) file anyway: A lost template is a terrible thing. By uploading your templates to your server you are creating a backup copy that can be downloaded if needed. Having the .dwt file on your server won’t have any effect (positive or negative) on your site.
  8. Back up your .dwt file: Actually why not just back up your whole site occasionally?
  9. You can recover a Dreamweaver template: It’s a bit of effort but, if you ignored 8 and 9 above and have irretrievably lost your template file, you can recover it from a page based upon it.

Trivia: DWT actually stands for Dynamic Web Template not DreamWeaver Tempalate as many people believe.

BTW, you can take advantage of all these tips while using my free Dreamweaver template, Born on the 4th of July.

Peter Booth March 12, 2012 at 6:10 pm

THANK YOU THANK YOU THANK YOU!!!!!

Peter Booth March 11, 2012 at 5:32 pm

Not sure if you’re still monitoring this for questions, but just in case…
My site uses a template which holds a banner image at the top and a Table Of Contents down the left side of every page.
I updated the template file “mmuuf generic template.dwt” (and uploaded that file to the server — even though after reading your article I now realize I didn’t need to).
Then I opened my index.html file, deleted a letter in the body and retyped the letter so it would allow me to save the file and then I uploaded that file.
My understanding (based entirely on trial and error) is that when I save a file that uses my template, the template piece of the file is saved.
I went to my site, refreshed my index.html file and the template portion is still wrong (I’ve changed a link in my table of contents because I moved a file from a sub-directory up to the root level — not sure I’m using the correct language there).
So after changing the link in my template, the link is not changed in my index file.
Thanks so much for any help.
Peter
p.s. I read the article about finding all the pages that use the same template in order to ensure that my index.html file was using that correct template.

dwcourse March 11, 2012 at 5:52 pm

Peter, your files built from a template are updated when you save the template OR when you select menu: Modify>Templates>Update Pages…

After you update your pages, any page that has changed will have to be uploaded.

Remember only those elements from the template that are not in editable regions will be updated. Content in Editable Regions is unique for each page and not tied to the template.

Darlene Hart April 12, 2011 at 2:26 pm

Is it possible to identify which pages have been generated by a specific template without actually making a change to the template and choosing to update? I want to document which files are associated with each of my templates and I would be thrilled to find a simple way of doing that. Thank you.

jcook April 13, 2011 at 8:53 am

You can use Dreamweaver’s Find function to locate all the files using a template. The instructions are available in my recent post: Templates: Find all pages using the same template.

Comments on this entry are closed.

Previous post:

Next post:

Home | Make Contact