Chapter 20. Snippets and Libraries

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

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

As you create more and more web pages (and more and more websites), you may find yourself crafting the same web page elements over and over again. Many of your pages may share common elements that always stay the same: a copyright notice, a navigation bar, or a logo, for example. And you may find yourself frequently using more complex components, such as a pull-down menu that lists all the countries you ship products to, or a particular design for photos and their captions.

Recreating 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 is simply a chunk of code you store away and then plunk into your web pages as necessary. The can be as simple as boilerplate legal text, or as complex as HTML, CSS, or JavaScript code (or code from any other programming language you encounter). ...

Get Dreamweaver CS5.5: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.