Chapter 17. Snippets and Libraries

You’ve finished the design for your company’s new Web site. It looks great and your boss is ecstatic. But you’ve only just begun. There are hundreds of pages to build before you launch. And once the site’s online, you’ll need to make endless updates to keep it fresh and inviting.

This is where Dreamweaver’s Snippet and Library features come in, streamlining the sometimes tedious work of building and updating Web pages.

As you build more and more Web pages (and more and more Web sites), you may find yourself creating the same Web page elements over and over again. Many pages of a site may share certain common elements that are always the same: a copyright notice, a navigation bar, or a logo, for example. And you may find yourself frequently using more complex items, such as a pop-up menu listing the twelve months of the year, or a particular table design you use for photos and their captions.

Re-creating the same page elements time after time is tiresome and—thanks to Dreamweaver—unnecessary. Dreamweaver provides two subtly different tools for reusing common page elements: Snippets and Library Items.

Snippets Basics

Snippets aren’t fancy or complex, but they sure save time. A snippet—new in Dreamweaver MX—is simply a chunk of code that you store away and then plunk into other Web pages. It could be HTML, JavaScript, or any of the other programming languages you might encounter. Dreamweaver comes with hundreds of snippets organized into different folders, ...

Get Dreamweaver MX: The Missing Manual now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.