Create a template page for your site
For this activity, you may either create a new page to save as your template,
or use an existing page that contains all of the layout and navigation
elements that you would like to have on all your pages (recommended).
It is also recommended that you use tables to lay out your entire page,
with navigation elements in one cell, and the body of your page in another.
This way, it is easy to select which parts of your page will be a part
of the template (i.e. the navigation) and which parts will be editable
when you create a new page based on the template (i.e. the table cell
with the body content).
- Open a new document or open an existing document from which to create
a template.
- If you are starting a new document, select "Template Page"
from the "General" tab of the new document dialog box, and
select "HTML Template". Click Create. This will create a new
template file.
- Create a layout table and add your navigation elements and other elements
that you wish to appear on every page. Save your page as template.dwt.
- For existing documents, go to File > Save as Template to convert
it to a Dreamweaver template file, and save your document as template.dwt.
- If you are using an existing document, delete the body content from
the page. (Don't worry, you saved it as a new file, so you aren't deleting
the original content.)
- Click inside the main body content cell of your layout table.
- Create an editable region for the body (main content area)
of your page. Go to Insert > Template Objects > Editable
Region, and give a name to your editable region like "bodyContent."
- Save your template by clicking File > Save, and close the document
window.
- Open one of your existing pages, such as syllabus.htm.
- Go to Modify > Templates > Apply Template to Page. A dialog
box will ask you which editable region you would like the content of
syllabus.htm to go into. For each section of content listed, such as
"Document Head" and "Document Body", select the
appropriate section (such as the "bodyContent" editable region
that you created) for the content to go in to.
- Dreamweaver applies your template, and puts the original content of
syllabus.htm in the editable regions of the template. You may have to
delete some of the navigation elements that are repeated in the "bodyContent"
region, so that all that remains is the main body content of the page.
- Save syllabus.htm (File > Save) and upload it to the server. View
it in the browser to see how it looks.
- Now, when you need to change a navigation or other element common
to all the pages, all you have to do is change it on the template file,
and Dreamweaver will ask if you want to update all pages associated
with the template, and then make changes to all the pages. Pretty convenient,
huh?
|