17.5 Library Basics

     

Imagine this situation: You manage a relatively large Web site consisting of thousands of Web pages. At the bottom of each page is a simple copyright notice: "Copyright MyBigCompany. We reserve all rights ”national, international, commercial, noncommercial, and mineral ”to the content contained on these pages."

Each time you add another page to the site, you could retype the copyright message, but this approach invites both typographic errors and carpal tunnel syndrome. And if you must format this text too, then you're in for quite a bit of work.

Fortunately, Dreamweaver's Library can turn any selection in the document window (a paragraph, an image, a table) into a reusable chunk of HTML that you can easily drop into any Dreamweaver document. The Library, in other words, is a great place to store copyright notices, navigation bars, or any other chunks of HTML you use frequently.

But this is only half of the Library's power. Each Library item that you add to a Web page is actually only a copy, which remains linked to the original. Thanks to this link, whenever you update the original Library item, you get a chance to update every page that uses that item.

Suppose your company is bought, for example, and the legal department orders you to change the copyright notice to "Copyright MyBigCompany, a subsidiary of aMuch- BiggerCompany" on each of the Web site's 10,000 pages . If you had cleverly inserted the original copyright notice as a Library item, you could take care of this task in the blink of an eye. Just open the item in the Library, make the required changes, save it, and let Dreamweaver update all the pages for you (Figure 17-3).

Compared to Snippets, Library items are much smarter . They possess the unique ability to update the same material on an entire site's worth of files in seconds and can successfully deal with links and images. Unlike Snippets, however, Dreamweaver's Library feature is site-specific. In other words, each site that you've defined in Dreamweaver has its own Library. You can't use a Library item from one site on a page from a different site.

The Museum of Modern Arts home page, which was created with Dreamweaver, takes advantage of Library elements. The site's logo (circled) is one of twelve Library items on this page. If the Museum decides to change its logo (or any property of the logo such as the image's Alt attribute), it can update it on every page of the local site in one simple step (Section 17.7). In fact, since a Library item is a chunk of HTML, the Museum could actually replace the logo with some text, a Flash movie, or any other valid HTML code.
figs/17_03.jpg


Dreamweaver MX 2004. The Missing Manual
Dreamweaver MX 2004: The Missing Manual
ISBN: 0596006314
EAN: 2147483647
Year: 2003
Pages: 191

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