TIP 130: Using Snippets


Snippets are, very simply, pieces of a page that you can use over and over again. A few examples would be an address, a table of data, or a piece of JavaScript. If you find that you are using one element on lots of pages, turn it into a snippet for drag and drop ease of use:

1.

Choose File > New, click Web, then choose Pages in the center pane and HTML in the right pane to start with a new, blank page.

2.

Type your name and address onto the page.

3.

Select everything you typed and drag it into the Application-wide folder in the Snippets area of the Library palette.

Try the Samples

There are some very handy samples included in the Snippets area of the Library palette. Go through and drag some of them onto a page to see what's there. Note that some of the included snippets are for use in the body of a page, whereas others, such as the meta snippets, are for the head portion of the page. Likewise, some snippets are easily used in the Source Editor, and others are perfect for the Layout Editor. Play around, and you'll see how flexible snippets can be.


The folder will automatically pop open, and you'll see a new file there called snippet.agls. If the filename isn't highlighted for renaming, press Return/Enter. Call it address.agls (Figure 130).

Figure 130. When you create a new snippet, give it a descriptive name.


Now follow these steps to complete the process:

1.

Choose File > New Page to get another new blank page.

2.

Drag the snippet you named address.agls onto the new page.

Tada! You have successfully created and used a snippet. You can create a snippet out of grids, tables, text, images, and more. If you have a styled table with an image and text, surrounded by additional text, grab the whole kaboodle and save it as one snippet.

To modify a snippet, double-click the file in the Library palette, make the changes, and then save the document. The changes will affect only the snippet you've edited, not the pages on which the snippet was already used.



    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