Snippets are a new tool that allow you to collect and manage sections of Code. In many ways the Snippets Library is a code library.
In this article you will learn how to use Snippets in Dreamweaver MX and how to create your own Snippets.
Snippets are a new tool that allow you to collect and manage sections of Code. In many ways the Snippets Library is a code library.
In this article you will learn how to use Snippets in Dreamweaver MX and how to create your own Snippets.
The main focus for this article has been with JavaScript. This is largely because the focus for Dreamweaver is on developing web pages. JavaScript is among the more complex elements used within a page design. Snippets, however, can manage any type of Script.
Dreamweaver now supports a large collection of server scripting languages such as C#, PHP and Java. Each of these can have their own collections in the Snippets Panel.
Within the Snippets Panel right click on the top category and select New Folder. This allows you to create a new folder in which you can add additional Snippets.
Create a new folder and name it PHP. Create a new Snippet and name is "Days of the Week." Add the following block of code:
Here is a simple PHP snippet. Working with a client that needs PHP, now you have a way to calculate days of the week.
Now, you can add a second folder named C#. Here is the code you will need to create days of the week quivalent in C#:
Now you have two different languages that deliver the same result saved as Snippets.
Matthew David has been developing Flash based applications for over 6 years (that makes him very old in this business!). Examples of his work can be found at his web site www.matthewdavid.ws, or you can email him directly at mdavid@email.com.
Matthew’s most recent publications include content for Flash 5 Magic, Inside Dreamweaver 4, Flash 5: Visual FX, Web Publishing Bible and The Dreamweaver Bible. You can also see him popping up in many online magazines, such as Sitepoint.com, Windowatch.com, UDzone.com and DevX.com.
Currently, Matthew is working on two books and writing articles for Element K Journal’s Macromedia Solutions magazine. He is a available as a freelance consultant to work on web based projects.
Comments
Be the first to write a comment
You must me logged in to write a comment.