Macromedia dreamweaver 8-using dreamweaver Manual De Usuario
160
Chapter 5: Managing Site Assets and Libraries
Here’s an example of how you might use a library item: suppose you’re building a large site for
a company. The company has a slogan that it wants to appear on every page of the site, but
the marketing department is still finalizing the text of the slogan. If you create a library item
to contain the slogan and use that library item on every page, then when the marketing
department provides the final slogan, you can change the library item and automatically
update every page that uses it.
a company. The company has a slogan that it wants to appear on every page of the site, but
the marketing department is still finalizing the text of the slogan. If you create a library item
to contain the slogan and use that library item on every page, then when the marketing
department provides the final slogan, you can change the library item and automatically
update every page that uses it.
Dreamweaver stores library items in a Library folder within the local root folder for each site.
Each site has its own library.
Each site has its own library.
When you use a library item, Dreamweaver doesn’t insert the library item in the web page;
rather it inserts a link to the library item. That is, Dreamweaver inserts a copy of the HTML
source code for that item into the document, and adds an HTML comment containing a
reference to the original, external item.
rather it inserts a link to the library item. That is, Dreamweaver inserts a copy of the HTML
source code for that item into the document, and adds an HTML comment containing a
reference to the original, external item.
The reference to the external library item makes it possible to update the content on an entire
site all at once by changing the library item and then using the update commands in the
Modify > Library submenu. Then, if you need to change some text for example, or an image,
updating the library item automatically updates the instance of the library in any page in
which you’ve inserted the library item.
site all at once by changing the library item and then using the update commands in the
Modify > Library submenu. Then, if you need to change some text for example, or an image,
updating the library item automatically updates the instance of the library in any page in
which you’ve inserted the library item.
When you create a library item that includes an element with a Dreamweaver behavior
attached to it, Dreamweaver copies the element and its event handler (the attribute that
specifies which event triggers the action, such as
attached to it, Dreamweaver copies the element and its event handler (the attribute that
specifies which event triggers the action, such as
onClick
,
onLoad
, or
onMouseOver
, and
which action to call when the event occurs) to the library item file. Dreamweaver does not
copy the associated JavaScript functions into the library item. Instead, when you insert the
library item into a document, Dreamweaver automatically inserts the appropriate JavaScript
functions into the
copy the associated JavaScript functions into the library item. Instead, when you insert the
library item into a document, Dreamweaver automatically inserts the appropriate JavaScript
functions into the
head
section of that document (if they aren’t already there).
There are special requirements for editing the behaviors in library items (see
). Library items cannot contain style sheets, because
the code for those elements is part of the
head
section.
NO
T
E
If the library item contains links, the links may not work in the new site. Also, images in a
library item aren’t copied to the new site.
library item aren’t copied to the new site.
NOT
E
If you hand-code JavaScript (that is, if you create it without using Dreamweaver
behaviors), you can make it part of a library item if you use the Call JavaScript behavior
to execute the code. If you don’t use a Dreamweaver behavior to execute the code, the
code isn’t retained as part of the library item.
behaviors), you can make it part of a library item if you use the Call JavaScript behavior
to execute the code. If you don’t use a Dreamweaver behavior to execute the code, the
code isn’t retained as part of the library item.