7.2 Create a new template
7.3 Saving templates
7.4 Change a page to a template
7.5 Setting up templates
7.6 Using templates
7.7 Editing templates
Templates are simply pages containing some content (like a letterhead) which can be re-used to start other pages. Templates are not altered in use and can be used over and over again. The simplest template is probably a blank sheet which links to a stylesheet for use throughout a site. More common is a page which has a banner and perhaps a menu to appear on every page. Last might be a complete page layout for use on all, or many, pages of a site but which includes areas for customising individually.
Templates may be considered as having two parts – the fixed part or ‘boilerplate’ which remains the same for every page and the editable part which alters.
Templates are prepared and edited using Nvu just like any other page.
To create a new template create the page using the menu commands File > New then select ‘A blank template’ and ‘Create’.
Add any content which will appear on all pages based on the template. Format this in the normal way. If the formatting is to be based on a style sheet prepare this in the normal way as detailed in section 4.2.4. For this to be successful the template must first be saved.
To save use File > Save or File > Save As menu commands. The type (extension) ‘mzt’ will be selected automatically.
A pre-existing document may be transformed into a template by selecting Format > Page Title And Properties and checking the box ‘This page is a template’. Then save the page.
The
boilerplate, fixed, content is set up and formatted as for any other
page. In use this content will, initially at least, not be editable by
the user.
Editable areas are added using Insert > Templates > Insert Editable Area.
Each editable area must be allocated a name. This appears as a label when used and also as initial text to be replaced.
Editable areas may be either block or ‘flow’.
A ‘Flow’ area sits in line with text in a paragraph or heading and takes the formatting from its context. It is allocated to a ‘span’ element so in HTML tags view specific formatting can be applied.
Block areas are stand-alone items (like paragraphs) they are allocated to ‘div’ elements which allows them to be formatted.
Editable areas may be set up to be ‘Optional’, ‘Repeatable’ or ‘Movable’. In use, optional areas carry a small cancel sign which deletes them if not required. Repeatable items carry a repeat sign which may be clicked as often as required to add additional copies. Movable items become Layers (see section 3.10).
Users will normally find it easier to set up all the boilerplate content first and then move the cursor and click in the positions where editable areas are to be added. Navigation may be difficult otherwise.
To
base a page on a template first
ensure that the template itself has been saved and closed – a
page cannot be based on an open template.
Start a new page by clicking File > New > A new document based on a template > Choose File. Select the Template (note templates have the file type ‘mzt’) Click ‘Create’.
The page that appears carries the boilerplate items, the labels for the editable areas and sample text (same as the labels) in the editable boxes. Click in the editable areas, delete sample text and replace with new text. If the editable area was repeatable a small square appears within the label, hovering turns it red and clicking makes a copy. Copies have small circles which act as delete buttons. The first figure illustrates a template with one flow item (the date) and one non-repeatable and one repeatable item repeated once. The first two items have the text replaced.
Warning - At Nvu 0.9 the text for repeatable items cannot be edited at this stage however copies may be made for editing later.
The page has been shown in HTML Tags view so that the use of ’span’ and ‘div’ tags is clear.
When all editable boxes have been completed detach the page from the template by clicking Edit > Detach from template. The page now assumes its final appearance. See second figure. Now it is possible to edit any item and as a workaround the frozen repeatable items may be added now.
Templates which have already been saved may be altered after opening using menu commands File > Open File and selecting ‘Files of Type’ then ‘All files’.
Note the default opening setting is ‘HTML Files’ which will not open templates.

Nvu User Guide - Based on Nvu version 0.9 - Updated 01-Apr-2005