4. Updating Your Web Sites with Libraries
The effectiveness of the Dreamweaver Library feature
becomes more significant when it comes time to update an entire
multipage site. Dreamweaver offers two opportunities for you to update
your site:
Immediately after modifying a Library item, as explained in the preceding steps for editing a Library item
At a time of your choosing, through the Modify => Library command
You can immediately update every page on your site
when you edit a Library item. After you save the alterations,
Dreamweaver asks if you'd like to apply the update to Web pages in your
site. If you click Yes, Dreamweaver not only applies the current
modification to all pages in the site, but it also applies any other
alterations that you have made previously in this Library.
The second way to modify a Library item is by using the Modify => Library command; when you use this method, you can choose to update the current page or the entire site.
To update just the current page, choose Modify => Library =>
Update Current Page. Dreamweaver quickly checks to see what Library
items you are managing on the current page and then compares them to
the site's Library items. If any differences exist, Dreamweaver
modifies the page accordingly.
To update an entire Web site, follow these steps:
Choose Modify => Library => Update Pages. The Update Pages dialog box opens (see Figure 5).
If
you want Dreamweaver to update all the Library items in all the Web
pages in your site, select Entire Site from the Look In drop-down list
and choose the name of your site in the drop-down list on the right.
You can also have Dreamweaver update only the pages in your site that
contain a specific Library item. Select the Files That Use option from
the Look In drop-down list and then select the Library item that you
would like to have updated across your site from the drop-down list on
the right.
If
you want to see the results from the update process, leave the Show Log
checkbox selected. (Turning off the Show Log option reduces the size of
the Site Update dialog box.)
Click
the Start button. Dreamweaver processes the entire site for Library
updates. Any Library items contained are modified to reflect the
changes.
NOTE
Although Dreamweaver does modify Library items
on currently open pages during an Update Site operation, you have to
save the pages to accept the changes.
The Update Pages log displays any errors encountered
in the update operation. The following log notation indicates that one
Web page contains a reference to a Library item that has been removed:
item Library\Untitled2.lbi - not updated, library item not found
Although this is not a critical error, you might
want to use Dreamweaver's Find and Replace feature to search your Web
site for the code and remove it.
NOTE
When updating Library items, every page is
physically changed with the necessary Library item code. This means
that every file containing a Library item must be uploaded to the
server.
In this Technique, you see how easy it is to add Library items to the page and update them as necessary.
From the Techniques site, open the library_items_start2.htm file from the 29_Library_Items folder.
Place your cursor at the bottom of the page in the #footer div.
Select the placeholder <p> tag there and remove it by pressing Delete.
From the Assets panel, select the Library category if necessary.
Choose the textNavigation entry.
Click Insert at the bottom of the Assets panel.
You can also drag Library items onto the page.
Now that you have the same Library item in a couple of locations, alter it. Double-click the textNavigation Library item.
Dreamweaver opens the Library item file in its own window.
Place your cursor after the About Us link and enter the following: - Guides.
Select the word Guides and, from the Properties panel's Link field, drag the Point to File icon to the file guides.htm in the 29_Library_Items folder.
It's always best to let Dreamweaver create the links for templates and Library items.
Choose File Save.
Dreamweaver displays the Update Library Items dialog box with the pages containing the current Library item. Click Update.
While Dreamweaver processes the modifications, the Update Pages dialog box is displayed; click Close when it's finished.
Close the textNavigation.lbi file.
Notice that the library_items_start2.htm file has been modified and the new item is now available from the text navigation.
Choose File Save to store the library_items_start2.htm file.
If you like, you can open the original file, library_items_start1.htm, to verify that it, too, has been updated.