After completing this tutorial you will be able to:
- Create a library
- Manipulate Library Items
- Edit Navigation Items
Libraries?
Templates and libraries overview
A template is a document that you can use as the foundation for other documents. When you create a template, you can indicate which elements of a page should remain constant (non-editable) and which elements can be changed. For example, if you are publishing an online magazine, the masthead probably won't change, but the title and content of the feature story will change in every issue. To indicate the style and location of the feature story, you can use placeholder text and define it as an editable region. To add a new feature article, the writer just selects the placeholder text and types the article over it.
You can modify a template even after you have used it to create documents. Then, when you update documents that use the template, the locked (non-editable) sections of those documents are updated to match the changes to the template.

Dreamweaver also provides two ways to deal with recurring content so that you don't have to change it on every page of the site: library items and server-side includes. You might use these approaches for content that appears on every page of the site (such as a header or footer) or for content that appears on only a few pages but must be updated frequently (such as news headlines or sales specials). These approaches are appropriate to different kinds of sites:
- Library items are safe to use on every site and should always be used for sites that will be viewed locally.
- Server-side includes can be used only for sites that are viewed from a server, and only on servers that are configured to process server-side includes.
Creating a Library
Different pages in a Web site often share some identical content. One way to handle elements that remain the same is to put them in frames. However, frames have the disadvantage of placing a heavier load on the server than normal Web pages. Also, sometimes frames won’t provide the solution you need. For example, suppose that you wanted to repeat a standard price for several different items on a very large Web page. In that case, frames couldn’t do the job. One solution is to use library elements.
You create a library element once, then add it to every page where you want it to appear. When it comes time to update those pages, you don’t need to go through the tedious process of making the alteration on every one of the pages individually. Just change the single library item, tell Dreamweaver to update every page that uses it, and let the program do the work for you.
Dreamweaver provides other features for working with repeated elements. It includes extremely sophisticated search and replace facilities, which you can use for updating repeated elements, even if those elements are on different pages.
Dreamweaver’s templates are similar to library elements, but use a reverse approach. Library elements are useful when you have a series of pages on which only a small portion of the content is standardized. Templates, although they can be used in the same way, are particularly handy when there are many portions of the pages that are identical, and there are only small differences.
Library elements are perfect for those smaller portions of Web pages that are identical. For example, in a small site, with maybe five or six pages, you may have navigation links at the top or bottom (or both) of every page to provide a path to each page in the site.
As another example, consider the one thing that nearly every site has in common; copyright notices. If you’re constantly updating your content, then you’ll need to change the copyrights every year on every page. Or, if you suddenly become more successful, you may want to change the name of the copyright holder from your own personal one to your new corporate identity.
If you needed to make even the smallest adjustment to such a set of links or another common element - like adding one more page or changing a company name - you would normally be faced with a time-consuming job. You would need to open each page in your site, alter the settings, save that page, then move on to the next one. Even for a handful of pages, this can be quite tedious (it’s certainly one of the least exciting parts of Web work). If you had to do this sort of thing for a large site or for several clients, it could be enough to make you wish you had gone into some more stimulating line of work, like candle dipping.
Make that repeated element into a library item, though, and you’ll fall in love with Dreamweaver all over again. It takes all the labor of maintaining that item. And isn’t this what computers are for - liberating us from menial, repetitive tasks. When you need to change all the pages, just do it once and let Dreamweaver take care of the dreary task of applying that change to all the places it needs to be implemented.
The easiest way to create a library item is to select the portion of your Web page that you want to make into a library item and then drag it into the lower pane of the Library palette.
Alternatively, you can select the item on the page and click the New Library Item button in the Library palette. This button is the first of the three buttons on the bottom right of the palette. If you like to take the long way around, you could also, after selecting the item, select Modify>Library>Add Item to Library from the menu, but the mouse approach is much faster.
At this point, the item will be automatically named Untitled, and if there’s more than one untitled library item, it will be followed by a number. If you don’t change the title, the number is one higher than the last one that Dreamweaver assigned to the more recently created library item. To change the title to something more useful, just type over the automatically assigned one.
If you don’t change the title at this point and want to do it later, you’ll need to do two slow clicks on the title to prepare if for editing. (If you click too quickly, it will be a double-click, which will open the file for editing instead of allowing you to change the title.) Also, if you’ve already added the item to your pages - or even to a single page-those entries will be orphaned by renaming the library item. They’ll still exist, but you’ll need to use the Recreate button on one of them if you want to be able to update them via the library.
When you create a library item, you select a portion of a document's BODY section, and Dreamweaver converts the selected area into a library item. Library items can include any BODY element, including text, tables, forms, images, Java applets, plugins, and ActiveX elements. Dreamweaver stores only a reference to linked items such as images. The original file must remain at the specified location for the library item to work correctly.
Library items can also contain behaviors, but there are special requirements for editing the behaviors in library items; Library items cannot contain timelines or style sheets, because the code for these elements is part of the HEAD section.
Creating Library Items
To create a library item:
- Select a portion of a document to save as a library item.
- Do one of the following:
- Choose Window > Library and drag the selection into the Library palette.
- In the Library palette, click the context menu button, then select Create Library Item.
- Click the New Library Item icon in the lower right area of the Library palette.
- Choose Modify > Library > Add Object to Library.
- Enter a name for the new library item.
Library preferences
You can customize the highlight color for library items and show or hide the highlight color in Highlighting preferences.
To change the highlight color for library items:
- Choose Edit > Preferences and select Highlighting.
- Click the color box to select a color for library items.
- Select Show to toggle the display of the library highlight color.
NOTE: VIEW > INVISIBLE ELEMENTS MUST ALSO BE ON FOR THE LIBRARY HIGHLIGHT COLOR TO BE VISIBLE IN THE DOCUMENT WINDOW.
- Click OK to close the Preferences dialog box.
Adding a library item to a page:
When you add a library item to a page, the actual content is inserted in the document along with a reference to the original item. After the content has been inserted, the original item does not have to be present for the content to be displayed.
Adding Library Items
To add a library item:
- Place the insertion point in the Document window.
- Choose Window > Library or click the Library button on the Launcher.
- Drag an item from the Library palette to the Document window, or select an item and click Insert.
TO INSERT THE ITEM'S CONTENT WITHOUT CREATING AN INSTANCE OF THE ITEM IN THE DOCUMENT, PRESS CONTROL WHILE DRAGGING AN ITEM OUT OF THE LIBRARY PALETTE.