Previous Section  < Day Day Up >  Next Section

17.7 Edit Library Items

You'll appreciate the real power of Library items when it's time to make a change. When you update the file in the Library, all pages that you've graced with that item update themselves, too.

Start by opening the Library, as described in Section 17.6. Then:

  1. Open the Library item that you want to edit.

    You can do this by double-clicking the Library item in the Assets panel, by highlighting it and then clicking the Edit button Figure 17-4), or by highlighting a Library item on a Web page and then clicking the Open button on the Property inspector (Figure 17-5). (You can also open the Library item file梐n .lbi file梚n the Library folder of your site's root directly from the Site window.)

    Dreamweaver opens what looks like a miniature Web page document, containing nothing but the text, graphics, or other elements of the Library file.

    The selected Library item (an .lbi file) is in the site's Library folder. (The path appears after the word Src.)
  2. Edit away.

    A Library item is only a selection of HTML; it's not a complete Web page. That means you can't edit page properties like the title or background color. Also, Library items can only be inserted in the body of a Web page, so stick with objects that would normally appear in the document window, such as links, images, tables, and text. Don't add any code that appears in the head of a Web page, such as Cascading Style Sheets, meta tags, behaviors, or timelines.


    Even though you can't add a Dreamweaver behavior to a Library item, you can include HTML code that uses Dreamweaver behaviors in a Library item.

    For example, suppose you create a navigation bar with rollover graphics. You could select the navigation bar and turn it into a Library item. Even though Dreamweaver doesn't actually put the JavaScript programming into the Library item, whenever you add the Library item to a page, Dreamweaver is smart enough to add the necessary JavaScript code to the Head of the Web page.

  3. Choose FileSave.

    Dreamweaver checks to see if there are any pages that use the Library item, and if there are, opens the Update Library Items window. A list of all pages in the site that use that Library item appears.

  4. Click Update.

    Dreamweaver opens the Update Pages window, updates the HTML in all the pages that use the Library item, and then lists all of the files that it changed.

    On the other hand, you don't necessarily have to click Update. Perhaps you have a lot of changes to make to the Library item, and you just want to save the work you've done so far. You're not done editing it yet, so you don't want to waste time updating pages you'll just have to update again. You can always update later (see the box in Section 18.7.2); in that case, click Don't Update. (Once you're finished with the changes and save the file for the final time, then update the site.)

  5. Click Done.

    As you can see, the Library is an incredible timesaver that greatly simplifies the process of changing common page elements.

17.7.1 Renaming Library Elements

To rename something in your Library, click its name on the Assets panel (Figure 17- 4). On the Mac, the name immediately becomes highlighted for editing. In Windows, you must pause briefly, click again, and then type the new name.

If you've already added the item to your Web pages, Dreamweaver prompts you to update those pages. Click Update. Otherwise, the link will break between those pages and the Library.

If you accidentally click Don't Update, don't panic. Simply change the Library item back to its original name, and then re-rename it. Don't forget to click Update this time!

17.7.2 Deleting Library Elements

You can delete unnecessary elements from your Library at any time, but do so with caution. When you delete something from the Library, Dreamweaver leaves behind every copy of it that you've already placed onto your Web pages梒omplete with links to the now-deleted Library item.

In other words, you won't be able to edit the copies on your Web pages until you break those links. If you do indeed want to edit them, you'll have to do that manually on each page where the Library item appears, selecting the item and then clicking the Detach from File button (see Figure 17-5).

Now that you've been warned, here are the instructions. To get rid of a Library item, click it in the Assets panel, and then do one of the following:

  • Click the Trash can icon in the Assets panel.

  • Press the Delete key.

  • Right-click (Control-click) the item's name and choose Delete from the contextual menu.

If you ever delete an item from the Library accidentally, you can recreate it, provided you've used it somewhere on one of the Web pages in the site.

Open the page containing the Library item, and then click the Library item to select it. Click Recreate on the Property inspector (Figure 17-5) to make it anew. A new Library item appears in the Library, using the name and HTML from the item you selected.

    Previous Section  < Day Day Up >  Next Section