Specifications
582
Snippets panel functions
Using Macromedia Dreamweaver MX, 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 ship with Dreamweaver MX are stored in the following folders:
• Accessible
• Comments
• Content_tables
• Filelist.txt
• Footers
• Form_elements
• Headers
• Javascript
• Meta
• Navigation
• Te xt
Snippet files are XML documents, so you can specify the encoding in the XML directive as 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".