Templates

DW supports a non-HTML feature called ``templates''. This is a powerful concept, since DW takes on the responsibilities to make every page of a site look the same structurally.

To do this, after you create a file with the proper layout, simply use the ``Save As Template'' menu item from the ``File'' menu. This adds the template to your ``Assets'' under the ``File'' tab in the Design pane to the right of the screen. This method is useful if you already have created some webpages, and want to use them as templates for future pages.

You can double click on the template asset (in ``Files'' tab in the ``Design'' pane) to edit it.

Otherwise, if you are just beginning, you can use ``File | New'', then select ``Template Page'' (under the ``General'' tab). Be sure to select the right Template Page option based on your scripting language. Most students in this class should choose ``HTML Template'' because there is no scripting for most.

A template is much like a normal HTML page. You can put any content into it, set the background image and etc.

Extra features for templates are found under the ``Template'' tab on the insert bar. Put the cursor in a cell that changes for each webpage, then click the insert region tool (the pen on folder icon) to make that cell editable for pages created from this template. Note that unless you mark a cell editable by inserting an ``edit region'', pages created from a template cannot be modified!

You can create as many edit regions as you want to. You can even create edit regions outside layout cells.

To remove an editable region, click on the blue tab of the region, (look at the Properties pane to make sure you have selected the region), then use ``Modify | Templates | Remove Template Markup'' to remove an editable region.

Once you save a template file, you can now create new pages based on this template. Note that you can define multiple templates for each website.

If you already have pages created from a template, saving changes to the template will automatically pop up a dialog box to ask you to confirm the update of all affected webpages. In general, click ``Update''. If you remove editable regions in a template, DW gives you a choice to put the content that used to be in the remove editable region to elsewhere in the document.

To create a file from a template, choose ``File | New'', use the ``Templates'' tab to select the template you wish to use. Make sure ``Update Page when Template Changes'' is checked so that DW will do as much as it can to keep this page updated when the layout of the template changes.

Files created from templates have ``Edit Regions'' (blue tab and blue borders) that you can insert contents. You can only edit in these edit regions.

Tak Auyeung 2004-03-07