1. Dreamweaver Library Items
Library items within Dreamweaver are another means
for you, as a designer, to maintain consistency throughout your site.
Imagine that you have a navigation bar on every page that contains
links to all the other pages on your site. It's highly likely that
you'll eventually (probably more than once) need to make changes to the
navigation bar. In a traditional Web development environment, you must
modify every single page. This creates numerous opportunities for
making mistakes, missing pages, and adding code in the wrong place.
Moreover, the whole process is tedious — ask anyone who has had to
modify the copyright notice at the bottom of every Web page for a site
with more than 1,000 pages.
One traditional method of updating repeating elements is to use server-side includes.
A server-side include causes the server to place a component, such as a
copyright notice, in a specified area of a Web page when it's sent to
the user. This arrangement, however, increases the strain on your
already overworked Web server, and many hosting computers do not permit
server-side includes for this reason. To add to the designer's
frustrations, you can't lay out a Web page in a WYSIWYG (What You See
Is What You Get) format and simultaneously see the server-side scripts
(unless you're using Dreamweaver). Therefore, you either take the time
to calculate the specific amount of space the server-side script takes
up on the Web page, or you cross your fingers and guess.
Dreamweaver offers you a better way. You can use an important innovation called the Library.
The Library is designed to make repetitive updating quick, easy, and as
error-free as possible. The Library's key features include the
following:
Any item — whether text or graphic — that goes into the body of your Web page can be designated as a Library item.
After
they are created, Library items can be placed instantly in any Web page
in your site, without your having to retype, reinsert, or reformat text
and graphics.
Library items can be
altered at any time. After the editing is complete, Dreamweaver gives
you the option to update the Web site immediately or postpone the
update until later.
If you are making a
number of alterations to your Library items, you can wait until you're
finished with all the updates and then make the changes across the
board in one operation.
You can update one page at a time, or you can update the entire site all at once.
A Library item can be converted back to a regular non-Library element of a Web page at any time.
Library items can be copied from one site to another.
Library
items can combine Dreamweaver behaviors — and their underlying
JavaScript code — with onscreen elements, so you don't have to rebuild
the same navigation bar every time, reapplying the behaviors repeatedly.
2. Using the Library Assets Panel
Dreamweaver's Library control center is located on
the Assets panel in the Library category. Here you find the tools for
creating, modifying, updating, and managing your Library items. Shown
in Figure 1,
the Library category is as flexible and easy to use as Dreamweaver's
other primary panels, with straightforward command buttons, a listing
of all available Library items, and a handy Preview area.
You have two ways to access the Library items:
To use Library items, you must first create a site root folder for Dreamweaver;
Library items cannot be modified when you are working directly with an
FTP or RDS server. A separate Library folder is automatically created
to hold the individual Library items and is used by Dreamweaver during
the updating process.
|
|
Ideally, you save the most time by creating all your
Library items before you begin constructing your Web pages, but most
Web designers don't work that way. Feel free to include, modify, and
update your Library items as often as necessary as your Web site
evolves — that's part of the power and flexibility you gain through
Dreamweaver's Library.
2.1. Adding a Library item
Before you can insert or update a Library item, that
item must be designated as a Library item within the Web page. To add
an item to your site's Library, follow these steps:
Select any part of the Web page that you want to make into a Library item.
Open the Library category of the Assets panel.
From the Library category (refer again to Figure 1), click the New Library Item button.
The
selected page element is displayed in the preview area of the Library
category. In the Site list — the Library item list — a new entry is
highlighted with the default name Untitled.
NOTE
If the text you've selected has been styled by a
CSS rule, Dreamweaver warns you that the appearance may be different
because the style rule is not included in the Library item. To ensure
that the appearance is the same, include the Library item only on those
pages with the appropriate CSS styles.
Enter
a unique name for your new Library item and press Enter (Return). The
Library item list is re-sorted alphabetically, if necessary, and the
new item is included.
A second option for creating Library items is the
drag-and-drop method. Simply select an object or several objects on a
page and drag them to the Library category (either the preview area or
the Site list pane); release the mouse button to drop them in.
You can drag any object into the Library panel:
text, tables, images, Java applets, plugins, and/or ActiveX controls.
Essentially, anything in the Document window that can be HTML code can
be dragged to the Library. Similarly, as you might suspect, the reverse
is true: Library items can be placed in your Web page by dragging them
from the Library category and dropping them anywhere in the Document
window.
|
When a portion of your Web page has been designated as a Library item,
yellow highlighting is displayed over the entire item within the
Document window. The highlighting helps you to quickly recognize a
Library item. If you find the effect distracting, you can disable it.
Go to Edit => Preferences (Dreamweaver =>
Preferences) and, from the Highlighting panel of the Preferences dialog
box, clear the checkbox to the right of the Library Items color
selection. Alternatively, clearing View => Visual Aids => Invisible Elements hides Library Item highlighting, along with any other invisible items on your page.
Dreamweaver can include Library items only in the <body> section of an HTML document. You cannot, for instance, create a series of <meta> tags for your pages that must go in the <head> section. |