A template allows the combination of redundant items to be used easily over and over again. The header, footer, and navigational links of this Web site are part of my Dreamweaver Management Tools workshop template. When I created this page (and all the others) I called up the template I created and stuck the content in it. Everything else was already there.
So what? I could also do that using the "Save As..." command and a generic page. This is true, but when I make a change to the template I can update any page that was created with that template automatically. Try that the other way!
If you're not convinced, how about applying a template to an existing page? That's right! Delete the stuff you don't want on your current page, apply the template and you're done.
Still not enough? I can also mark sections of the template as being uneditable, meaning I can't accidentally erase the redundant stuff unless I go back to the original template and change the item.
Create a Template
Let's make a template using the Library Object created earlier.
- go to the "File" menu
- choose "New..."
- in the dialog box click on the "General" tab
- in the "Category:" column choose "Template Page"
- in the "Template page:" column choose "HTML template"
- click "Create"
- make the title of the page "Place Your Title Here"
- insert the Library Object "Repetitive Stuff for Every Page"
- go to the "File" menu
- choose "Save"
- click "Okay" in the alert box about not having an editable region as we'll do this in the next section
- name the file "FirstTemplate"
- click "Save"
Mark Region as Editable
By default, everything in a template is uneditable except for the page title. To make a region editable, it needs to be selected first.
- click after the Library Object in the page
- go to the "Insert" menu
- choose "Templates Objects>Editable Region"
- name the region "Content"
- click "OK"
- save the template
You should now see [Content] as a tab in your template page. This will be an editable region in any page made from this template, but the Library Object will not be editable.
Other editble regions may also be created to suit your design layout.
Use a Template
Make a New Page from a Template
- go to the "File" menu
- choose "New..."
- in the dialog box click on the "Templates" tab
- in the "Templates for:" column choose your current site
- in the "Site:" column choose "FirstTemplate"
- click "Create"
- put the following text in the [Content] region
- This is some content
Try editing the other areas on the page. If all is working well, you can't.
Apply a Template to an Existing Page
To see how this is done, create a file named "ApplyToMe.html".
- go to the "File" menu
- choose "New..."
- in the dialog box click on the "General" tab
- in the "Category:" column choose "Basic Page"
- in the "Basic page:" column choose "HTML"
- click "Create"
- title the page "Apply to Me"
- type in the following text
- Here is some more text.
- This is another paragraph of text.
- save the page
Now, apply the template.
- go to the "Modify" menu
- choose "Templates>Apply Template to Page..."
- choose your site in the drop-down menu
- pick "FirstTemplate"
- click "Select"
Dreamweaver will prompt you for where you want your existing content to go. You get 3 guesses!
When you're ready, move on to "Find and Replace."