Site Links

Home

Instructor Schedule

Tutorials

Resources

Conditions of Use

Templates and Libraries

Learning Objectives: (originally created for Dreamweaver 3)

In this section, you will learn

About Templates and Libraries

Creating a Web site is a combination of the excitement of producing visually pleasing web pages, and the tediousness of repeating elements such as color schemes, addresses, and format over and over again. Using Dreamweaver 3, you can create a template for a consistent look and feel, as well as libraries, for repeating elements, such as your navigation bar or a company logo, for each page. Templates and libraries allow you to update and maintain your pages quickly and efficiently.

arrow pointing right Templates are composed of two types of regions: locked and editable.

Every element on a template falls into these two categories. Either you have an element that is always there, and therefore locked into its position, or you have content that will be added from page to page, and lies in an editable region. When you first create a template, all areas are locked. Part of the process in creating a template involves defining which portions of that document can be altered, or editable. After they are created, templates can be altered to mark additional editable areas or to relock editable areas. You can also detach a document from a template, and edit anything in the document. However, you cannot reattach the document to a template without losing the new content.

arrow pointing right A document based on one template can be changed to a completely different look but with the same content, if it is attached to a new template with identical editable regions.

You can design a template any way you'd like. Perhaps the best course is to create a single page that has all the elements you wish included on your template. Then convert that document into a template, and mark all the changeable areas - whether images or text - as editable regions. Before saving your document as a template, consider the following:

Return to Top

Editable Regions

Once you have a page created that has all the information you want included for a template, select File > Save as Template. The entire document is now locked. If you tried to create a new document from this template "as is", you would receive an alert box from Dreamweaver, informing you that the template does not have editable regions.

There are two ways to mark your template for editable regions. The simplest way is to designate any existing content as an editable region. The second way is to insert a new editable region anywhere you place your cursor. In either case, you will have to give each region a unique name. Dreamweaver uses the unique name to identify the editable region when entering new content, applying the template, and exporting or importing XML.

arrow pointing right Each editable region must have a unique name, but the names need only be different from other editable regions on the same page.

arrow pointing right A common problem in using templates are in the creation of links. Often, a link is added to a template but it won't work with the new page created using the template. The main cause of error is with the path. Dreamweaver puts the page into the Templates folder, which tends to removed one level away. Using the folder icon to link to an existing file should remedy this.

arrow pointing right There is a known problem when using lists in template-based pages. If you select a series of lines in an editable region, and then try to convert them to a bulleted or numbered list, Dreamweaver improperly inserts the code above the lines. This can also happen if you try to indent the lines. One workaround is to use the Quick Tag Editor in Wrap Tag mode to surround the text with <ul> or <ol> tags. You will then need to manually insert the <li> tag to each item.

arrow pointing right You cannot use some features when editing Library items. Timelines, behaviors and styles requires a JavaScript function to be placed in the <head> tags of a page. You will need to add the behavior to the page element before converting to a Library item.

 

~ peace, polka and piwo