Snippets panel functions
323
Snippets panel functions
Using Dreamweaver, web developers can edit and save reusable blocks of code in the Snippets
panel and retrieve them as needed.
The Snippets panel stores each code snippet in a CSN file within the Configuration/Snippets
folder. Snippets that come with Dreamweaver are stored in the following folders:
•
Accessible
•
Comments
•
Content_tables
•
Filelist.txt
•
Footers
•
Form_elements
•
Headers
•
Javascript
•
Meta
•
Navigation
•
Text
Snippet files are XML documents, so you can specify the encoding in the XML directive, as
shown in the following example:
<?XML version="1.0" encoding="utf-8">
The following sample shows a snippet file:
<snippet name="Detect Flash" description="VBscript to check for Flash ActiveX
control" preview="code" factory="true" type="wrap" >
<insertText location="beforeSelection">
<![CDATA[ ------- code --------- ]]>
</insertText>
<insertText location="afterSelection">
<![CDATA[ ------- code --------- ]]>
</insertText>
</snippet>
Snippet tags in CSN files have the following attributes:
You can use the following methods to add Snippets panel functions to your extensions.
Attribute
Description
name
Name of snippet
description
Snippet description
preview
Type of preview:
"code"
to display the snippet in preview area or
"design"
to
display the snippet rendered in HTML in the Preview area.
type
If the snippet is used to wrap a user selection,
"wrap"
; if the snippet should be
inserted before the selection,
"block"
.
000_DW_API_Print.book Page 323 Wednesday, August 20, 2003 9:14 AM
Summary of Contents for DREAMWEAVER MX 2004-DREAMWEAVER API
Page 1: ...Dreamweaver API Reference...
Page 24: ...24 Contents...
Page 32: ......
Page 70: ...70 Chapter 5 Fireworks Integration...
Page 76: ...76 Chapter 6 Flash Integration...
Page 116: ...116 Chapter 9 The JavaBeans API...
Page 140: ......
Page 152: ...152 Chapter 11 Application...
Page 218: ...218 Chapter 12 Workspace...
Page 248: ...248 Chapter 13 Site...
Page 292: ...292 Chapter 14 Document...
Page 378: ...378 Chapter 17 Design...
Page 430: ...430 Chapter 18 Code...
Page 486: ...486 Index...