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 if you're really putting the snippet into a form. Dreamweaver doesn't let you know if 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 not show up 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 after you insert the snippet into a page. For images, you can use Dreamweaver's Image Placeholder object to simulate a graphic in a snippet (choose Insert Image Objects 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, described in Section 17.5. |