• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

17.4. Built-in Snippets

Many of the snippets that come with Dreamweaver offer solutions to specific problems you may never encounter, like a page footer containing two lists of links and a copyright notice. However, some of them are useful for most Web developers. Here are some examples:

UP TO SPEED
A Snippet of Caution

Snippets aren't as smart as other Dreamweaver features. Dreamweaver's usually good about warning you before you make a mistake, but it doesn't make a peep if you're adding a snippet incorrectly.

For instance, when you use one of the program's form snippets to add, say, a text field to a page, Dreamweaver doesn't check to see whether you're really putting the snippet into a form. Dreamweaver doesn't let you know whether the required <form> tag is missing, and certainly won't add it itself. Furthermore, if you're working in Code View, Dreamweaver lets you add snippets to the <head> or even outside the <html> tags altogether, which is useful when creating dynamic Web pages that include server-side programming code, but just creates messy and invalid HTML on normal Web pages.

Furthermore, snippets don't take advantage of Dreamweaver's site management features to keep track of links or paths to images. Suppose you create a snippet that includes an image. If you insert that snippet into another page, the image may or may not display correctly. If you create a snippet that includes a link from one page to another on your site, that link is also unlikely to work in another page.

So it's best to create snippets without images or links—but there are workarounds. For instance, you can create snippets with fake links—use nothing but the # symbol for the link, for example—and update the link later. For images, you can use Dreamweaver's Image Placeholder object to simulate a graphic in a snippet (choose Insert→Image Placeholder). After adding the snippet to the page, update the placeholder with your real image file.

If you want to create reusable content that can keep track of links and images, see Dreamweaver's Library feature, as described on the next page.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint