Creating a Library Item


A library item is a portion of content that can be reused on multiple pages. It is separated from the pages in your site and kept in a file located in the Library. The library item consists only of the code for specific content; it is not an HTML page in and of itself. You can create a library item by selecting one or more elements in a document and adding them to the Library. When you do this, Dreamweaver converts the selection into non-editable content that is linked to the corresponding library item. The following exercise demonstrates this process.

1.

Open the index.html file in Lesson_08_Interactivity. Scroll to the bottom of the page and find the copyright text. Select this entire paragraph.

Library items can only include content that appears between the <body> and </body> tags. They can include any document elements such as text, tables, forms, images, Java applets, plug-ins, or ActiveX elements.

To create a library item out of multiple elements, those elements must form a contiguous selection in the document. If you need noncontiguous items to function as a library item does, you need to create multiple library items.

The copyright text, email address, and modification date are standard information that might be used at the bottom of all pages within a Website. Libraries can be useful for this type of information.

Note

A library item containing relative paths (such as links to pages or images) can be placed in any level of your site's directory structure. Dreamweaver automatically calculates the correct paths to any elements that the library item might contain. Document-relative and site rootrelative paths were covered in Lessons 3 and 5.

2.

Click the Assets tab in the Files panel group and click the Library button on the lower left of the Assets panel to open the Library.

The Library category of the Assets panel opens, in which you will manage all your library items.

3.

Drag the selected copyright text into the Assets panel.

Tip

You can also choose Modify > Library > Add Object to Library to create a new library item.

A new library icon appears in the Library category of the Assets panel alongside a text field highlighting the generic name Untitled.

Note

When you create a library item, Dreamweaver creates a folder named Library at the top level of your local root folder and stores every library item that you create in that location. The Library folder must remain in its original location at the root level of your site for the library feature to function. This Library folder and the library files it contains are only stored locally; they do not need to be uploaded to a server unless you want to share them with other members of your Web team. Dreamweaver saves each library item with the .lbi file extension.

4.

Type copyright as the name for the new library item and then press Return (Macintosh) or Enter (Windows).

The library item is now known as copyright in the Library panel. Giving your library items descriptive names will help you to manage them throughout your site. The names are for your reference only and will not be displayed to the user in a browser window.

A preview of the library item appears at the top of the panel. You might need to click the library item icon to refresh the preview to see the elements.

Close the index.html file.




Macromedia Dreamweaver 8(c) Training from the Source
Macromedia Dreamweaver 8: Training from the Source
ISBN: 0321336267
EAN: 2147483647
Year: 2006
Pages: 326

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net