User Guide
62 Chapter 5 Writing Code and Web Content
Saving a code block as a snippet
A code snippet is a block of code or content that you store for reuse. You can
comment your snippets just as you would any code block.
To create a code snippet:
1 Before adding a snippet, you must create a folder. To do so, click the Snippets tab
in the Resources window and click on the Create Folder toolbutton or right-click
in the Snippets panel, and select Create Folder.
You can create additional folders or subfolders as needed. The default location
for snippets is the \UserData\Snippets folder below your root directory.
2 Enter a name for the folder.
3 To add a snippet, do one of the following:
− Drag and drop a block of selected text from the Editor to an existing folder.
− Click on the Add Snippet toolbutton.
− Right-click in the Snippets pane and select Add Snippet.
− Highlight a block of code in the Editor and right-click > Selection > Create
Snippet.
4 Enter a name for the snippet in the Description box. Note that snippet names
cannot contain characters that are illegal in filenames, such as slashes, special
characters, or double quotes.
5 In the Start Text window, enter or paste an opening code block. You can set a
default spacing between the blocks by pressing the Enter key at the end of the
start text and at the beginning of the end text.
6 In the End Text window, enter a closing code block.
7 Click OK.
Because snippets can be created as start and end blocks, you can use them to
surround other tags and content. This is handy for inserting special formatting,
navigation elements, and script blocks. Simply highlight the content you want to
surround, then insert the snippet.
To insert a code snippet, do one of the following:
• Click the Insert into Document toolbutton.
• Double-click an entry in the Snippets panel.
• Right-click and select Insert into Document from the popup menu.
To edit or delete a code snippet, do either of the following:
• Click the Edit Snippet or the Delete toolbuttons.
• Right-click the snippet and choose the appropriate command (Edit or Delete)
from the snippets shortcut menus.