Code snippets let you store content for quick reuse. You can create and insert snippets of HTML, JavaScript, CFML, ASP, JSP, and more. Dreamweaver also contains some predefined snippets that you can use as a starting point.
This section describes how to insert, create, edit or delete code snippets. It also describes how to manage your code snippets and share them with other members of your team.
NOTE |
|
With Dreamweaver 8, snippets containing <font> tags and other deprecated elements and attributes have been moved to the Legacy folder in the Snippets panel. |
You can also right-click (Windows) or Control-click (Macintosh) the snippet, then select Insert from the pop-up menu.
The Snippet dialog box appears.
For more information, see Setting the Snippets dialog box options.
The Keyboard Shortcuts Editor appears.
A list of snippets appears.
For more information, see Customizing keyboard shortcuts.
The purpose of this dialog box is to create or edit a code snippet for the Snippets panel.
NOTE |
|
Snippet names can’t contain characters that are invalid in filenames, such as slashes(/ or \), special characters, or double quotes ("). |
Insert Before Type or paste the code to insert before the current selection.
Insert After Type or paste the code to insert after the current selection.
To set default spacing for the blocks, use line breaks; press Enter (Windows) or Return (Macintosh) inside the text boxes.
NOTE |
|
Because snippets can be created as start and end blocks, you can use them to surround other tags and content. This is useful for inserting special formatting, links, navigation elements, and script blocks. Simply highlight the content you want to surround, then insert the snippet. |
If you select Design, then Dreamweaver renders the code and shows it to you in the Preview pane of the Snippets panel. If you select Code, then Dreamweaver shows the code in the Preview pane.