TIP 131: Using Components


There is one major difference between snippets and components. If you create a snippet, use it on ten pages, and then change the snippet file, no change is made to the pages that already use that snippet. Not so with components. If you create a component, use it on ten pages, and then change the component file, every page that uses the component will be updated to reflect the change.

Some examples of when components are perfect: navigation bars, copyright notices, or any item that is used on multiple pages but needs occasional updating.

The process for creating a component is a little different than for creating a snippet. Instead of dragging items off a page and into the Components section of the Library palette, you need to save the whole page as a component. To do so, either choose File > Save as and then choose Components from the Site Folder pop-up in the Save dialog box, or choose Save as > Component from the document's flyout menu (Figure 131a). Use a descriptive name when you save the file so that you know which component is which when you later go to use one on a page.

Figure 131a. Use the handy Site Folder pop-up to save directly into the site's component folder or save the file as a component via its flyout menu.


When the component is saved, it will appear both in the Components folder of the Site Extras and in the Components section of the Library palette. To use it, drag it from the Library palette onto a page.

Warning! Application-wide Library Items

The Application-wide folder in the Library palette is great for storing text-based items, but be wary of storing items there that reference an object that does not physically exist in your site, such as an image. Unless you are 100-percent sure that no object used in your snippet, component, stationery, or template is referenced outside of your site, stick with the site-specific folder.


To edit a component, double-click it in the Library palette, make your changes, and then save the file. When you save the component, any pages using that component will be automatically updated (Figure 131b). A dialog box will inform you when the update has been completed. Click OK.

Figure 131b. GoLive shows you which pages reference the component and will therefore be updated.


Note

After you change a component that is used on other pages, remember to upload the changed pages to the Web server.




    Adobe GoLive CS2 Tips and Tricks The 250 Best
    Adobe GoLive CS2 Tips and Tricks The 250 Best
    ISBN: B008CMGJS0
    EAN: N/A
    Year: 2005
    Pages: 301

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