64
Chapter 5 Writing Code and Web Content
Saving Code Blocks as Snippets
With code snippets, you can easily store code blocks and content for reuse.
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, right-click in the Snippets panel, and select Create
Folder from the menu.
Tip
You can create additional folders as needed. The default location for snippets is
the \UserData\Snippets folder below your root directory.
2
Enter a name for the folder.
3
Right-click in the Snippets pane and select Add Snippet to open the Snippet
dialog box.
4
Enter a name for the snippet in the Description box. Note that snippet names
cannot contain characters that are illegal in file names, such as slashes, special
characters, or double quotes.
5
In the Start Text window, type 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.
Tip
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:
•
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:
•
Right-click the snippet and choose the appropriate command (Edit or Delete)
from the snippets shortcut menus.
To manage code snippets and snippet folders:
•
Use the snippets shortcut (right-click) menus.
Содержание ColdFusion Server 5
Страница 18: ...xviii About This Book...
Страница 26: ...8 Chapter 1 Setting Up the Product...
Страница 42: ...24 Chapter 2 Configuring Browsers and Servers...
Страница 60: ...42 Chapter 3 Exploring the Workspace...
Страница 100: ...82 Chapter 6 Editing Pages...
Страница 126: ...108 Chapter 7 Using Web Development Languages...
Страница 212: ...194 Chapter 13 Customizing the Development Environment...
Страница 320: ...302 Glossary...