Placing a Library Item on a Page


Placing a library item in a document inserts the contents of the library item file and creates a reference to that library item. When you insert a library item, the actual HTML is inserted, meaning that the content always appearseven if the library item is not available in the Library folder. Dreamweaver inserts comments in the code around the item to show the name of the library file and the reference to the original item. The comments and reference are not visible in the browser window. The reference to the external library item file is what makes it possible to update the content on an entire site all at once simply by changing the library item.

1.

Open the community_intro.html file in the Lesson_12_Libraries/Community folder. Place the insertion point in the empty paragraph just below the paragraph beginning "One of the most important teachings…"

In the following steps, you will place the library item you created in the previous exercise into this document.

Tip

If the Library panel is not visible, choose Window > Assets and click the Library button in the Assets panel. The Assets panel is located in the Files panel group.

2.

Select the copyright library item in the Library category of the Assets panel and click the Insert button in the lower-left corner of the panel to insert the item into the document.

Tip

Alternatively, you can drag the copyright file icon from the Library panel to the location where you want it to appear in the document window.

The text is added to the document. The copyright library item is shown with a yellow background. Although library items are highlighted with yellow by default, the color can be changed or turned off completely in the Preferences dialog box. This item cannot be modified directly on the page. You will modify library items in the next exercise.

You can use the Property inspector to see the name of the source file and to perform maintenance functions for the library item that is selected in the document window. The Property inspector has several options:

  • Src: Displays the filename and location of the source file for the library item. You can open the library item for editing by clicking the Open button. You must save the file to keep the changes you make.

  • Detach from original: Breaks the link between the selected library item and its source file. The content of the library item becomes editable, but it can no longer be updated by the library update functions.

  • Recreate: Overwrites the original library item with the current selection. Use this option to create library items again if the library file isn't present, the item's name has been changed, or the item has been edited.

3.

Repeat Steps 1 and 2 to insert the copyright library item at the bottom of the Community/BeginningGreen.html file.

The benefit of library items becomes apparent when you reuse the library item in multiple pages.

4.

Open the Community/AboutGreen.html file and place the insertion point in the empty paragraph below the paragraph that begins "For more information…"

You will place a detached copy of the library item with copyright information on this page so it is editable in the document.

5.

Hold down Option (Macintosh) or Ctrl (Windows) and drag the copyright file icon from the Library panel to the bottom of the document.

The library content is copied into the document but is not linked to the library, so there is no yellow highlighting. The elements can be modified directly on the page because they are not connected to a library item. Because these elements are detached, they are not updated if any changes are made to the original library item.

6.

Save and close all files.




Macromedia Dreamweaver 8(c) Training from the Source
Macromedia Dreamweaver 8: Training from the Source
ISBN: 0321336267
EAN: 2147483647
Year: 2006
Pages: 326

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