About library items

About library items

A library is a special Dreamweaver file that contains a collection of individual assets or copies of assets you have created for placement in your web pages. These assets in a library are called library items. You can update all the pages that use a library item whenever you change the item’s contents. You can store all sorts of page elements, such as images, tables, sounds, and Flash files in a library.

Here’s an example of how you might use a library item: suppose you’re building a large site for a company. The company has a slogan that it wants to appear on every page of the site, but the marketing department is still finalizing the text of the slogan. If you create a library item to contain the slogan and use that library item on every page, then when the marketing department provides the final slogan, you can change the library item and automatically update every page that uses it.

Dreamweaver stores library items in a Library folder within the local root folder for each site. Each site has its own library.

When you use a library item, Dreamweaver doesn’t insert the library item in the web page; rather it inserts a link to the library item. That is, Dreamweaver inserts a copy of the HTML source code for that item into the document, and adds an HTML comment containing a reference to the original, external item.

The reference to the external library item makes it possible to update the content on an entire site all at once by changing the library item and then using the update commands in the Modify > Library submenu. Then, if you need to change some text for example, or an image, updating the library item automatically updates the instance of the library in any page in which you’ve inserted the library item.

When you create a library item that includes an element with a Dreamweaver behavior attached to it, Dreamweaver copies the element and its event handler (the attribute that specifies which event triggers the action, such as onClick, onLoad, or onMouseOver, and which action to call when the event occurs) to the library item file. Dreamweaver does not copy the associated JavaScript functions into the library item. Instead, when you insert the library item into a document, Dreamweaver automatically inserts the appropriate JavaScript functions into the head section of that document (if they aren’t already there).

There are special requirements for editing the behaviors in library items (see Editing a behavior in a library item). Library items cannot contain style sheets, because the code for those elements is part of the head section.

Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Managing Your Files
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly