Using the Assets Panel to Manage Library Items
Similar to templates, library items can be created, edited, and managed from the Library Items category in the Assets panel (see Figure 16.3).
Figure 16.3. Use the Library Items category in the Assets panel to manage library items in your defined site.
- Library Item list :
Displays a list of LBI files or library items in a defined site. The list provides the name of the library item, its size in kilobytes, and the path (usually within the Library folder of the defined site). - Library item preview :
Displays a preview image of the library item. - Insert :
Inserts the selected library item into the page. - Refresh Site List :
Refreshes the library item category to reflect changes made within the Files panel. - New Library Item :
Creates a new LBI file in the Library folder of your defined site. When this button is clicked, a new library item instance also appears in the library item list. - Edit :
Click this button to launch a selected library item from the library item list in a new Document window for editing. - Delete :
Deletes a selected library item. - Options menu :
Displays advanced options for working with and managing library items. These options are outlined with more detail next.
For the most part, general management of library items can be handled using the small button bar at the bottom of the Library Item category in the Assets panel. For more advanced options, however, access the options in the panel's Options menu.Options in the Library Items panel's Options menu include:
- Refresh Site List :
Refreshes all library items in the library item list. - Recreate Site List :
Reloads Dreamweaver's site cache. - New Library item :
Creates a new, blank library item. - Edit :
Opens the selected library item in editing mode. When the library item has been opened, you can make necessary changes, save the document, and then update the site. - Insert :
Inserts a library item into an existing page. - Rename :
Renames the selected library item. - Delete :
Deletes a selected library item. - Update Current Page :
Applies any changes made to a library item within its editing mode to the current open page that uses the library item. - Update Site :
Applies any changes made to a library item to all pages that use the library item in the current open site. - Copy to Site :
Copies the selected library item to another defined site. - Locate in Site :
Opens the File panel and highlights the library item in the list.
Creating Library Items
Two methods exist for creating library items in your site. First, you can create a new blank library item in the Assets panel and then add your content to the newly created file. Alternatively, you can highlight an existing element on a page and click the New Library Item icon at the bottom of the Library Items category in the Assets panel to convert that existing element to a library item. For our Dorknozzle example, we'll review both methods. First, we'll examine the process of creating a new library item and then adding the footer content to it. Secondly, because all the pages in our site use or will use the navigation menu, we'll convert our existing navigation menu into a library item so that all pages in our site can use the library item.TIPYou can also create a new library item directly from the New Document dialog. To use this method, choose File, New. Select the Library Item option from the Basic Page category and click Create.
Creating a New Blank Library Item
One of the methods of creating library items is to click the New Library Item icon in the Assets panel. Doing this creates a new blank library item that can be opened and edited to your liking. After you've edited the content, save the library item, close it, and then add it to any pages in your site. To create a new library item for your site using this method, follow these steps:
1. | Switch to the Library Items category in the Assets panel and click the New Library Item icon. Alternatively, choose the New Library Item option from the Assets panel's Options menu. Either method you choose creates a new Untitled Library item, similar to Figure 16.4.Figure 16.4. A new, untitled, blank library item is created in the Library Item list. | ||||||||||||||||||||||||||||||||
2. | Enter a name for your new library item (I'll call mine footer ) and press Enter to apply it to the item. | ||||||||||||||||||||||||||||||||
3. | With the new library item selected in the list, click the Edit icon (located second from the right in the button bar). You can also select the library item and press Enter to open the library item in Edit mode. | ||||||||||||||||||||||||||||||||
4. | S witch to the Files panel and drag the footer.txt file into the new library item. When the Insert Document dialog appears, select the Insert the Contents and the Text Only radio buttons and click OK. The content is inserted into the page. | ||||||||||||||||||||||||||||||||
5. | Format the content to your liking. I'll center the content on the page and add an email hyperlink to the Questions or Comments? text. | ||||||||||||||||||||||||||||||||
6. | Save your work, close the library item, and switch back the Library Items category in the Assets panel. The Library Item preview window shows what the new library item looks like (see Figure 16.5).Figure 16.5. The new library item appears in the Library Item list. A preview of the library item is also shown.NOTECSS style classes cannot be added to newly created library items. An alternative method is to create the library item on the page, apply your styles, and then save the element as a library item. This method is described in the next section. Converting Existing Elements to Library ItemsA secondand quite possibly more flexiblemethod for creating library items is to convert an existing element on a web page to a library item. This method provides two benefits: First and more importantly, it allows you to see how the library item looks in the context of the page design. Second, it allows you to apply style classes to the element before converting it to a library item. Because you can't apply styles directly to existing library items, this method is generally preferred.To demonstrate the process of converting existing elements to library items, follow these steps:
That's all there is to it. In the next section, we'll explore methods for adding library items to your web pages. Inserting Library Items into Web PagesAfter you've created a library item, adding it to your web pages is as simple as drag and drop. In the previous two sections, we created two library itemsone for the footer of every page and another for the navigation menu of the website. Although the helpdesk page already contains the navigation menu library item, we still must replace the navigation menus that exist on the other pages with our new nav library item. To do this, follow these steps:
Of course, you'll want to repeat these steps for the footer library item as well. When you finish, all three of th215 pages included with the files you downloaded for the Dorknozzle project should have a navigation menu and footer similar to what's shown on the helpdesk page in Figure 16.8. Figure 16.8. Add the navigation menu and footer library items to all three pages.[View full size image] Editing Library Items and Updating the SiteOf course, the benefit to using library items is that they can be edited centrally using a familiar interface in Dreamweaver's Design mode and then saved across the website. What this means is that, as with templates, changes can be made to one file, saved, and Dreamweaver instantly updates all files in the defined site that use that library item. To demonstrate this, assume that your supervisor has just accused you of being a wise guy for using the word illustrious in the footer to describe the Marketing department. To get back on his good side and avoid the wrath of Mike in Marketing, your supervisor asks you to change the word illustrious to the more subtle word distinguished . Had we not been using library items, we would be required to open every page to make these modifications. Because we're using library items, however, the change requires us to do little more than open the footer library item file, make the change, and save it. To do this, follow these steps:
|