Dreamweaver MX 2004 Extensions - Dreamweaver’s Server Behavior Builder
(Page 6 of 8 )
After so much talk about extensions and how you can benefit from using ready-made ones, we now take a look at one of the main ways in which you can create your own: the Server Behavior Builder.
Over the course of this book we have seen how useful Dreamweaver server behaviors are, and how much time they can save you during web development. Well, now you can create your own: introduced in Dreamweaver UltraDev 4, The Server Behavior Builder enables you to turn code snippets into powerful server behaviors. The Server Behavior Builder automates the creation of all the necessary files that make up the server behaviors. They consist of an HTML file and two or more Extension Data Markup Language (EDML) files.
The HTML file contains all the needed scripts and all the elements of the interface that will allow the user to use the server behavior, whereas the EDML files (which are basically XML files) are mainly used by Dreamweaver to identify and interpret the various code blocks that comprise the server behavior.
To better understand the content of the EDML files, a short digression on how a server behavior works is required. As you should have noticed in previous chapters, server behaviors differ from regular behaviors in the way they can be applied to your HTML code. In fact, because server behaviors mainly comprise server-side code, they can be placed on any part of your source code, even around selected areas. Each single code block of a server behavior is called a participant and is made up of an EDML file, while the list of all the participants needed by a server behavior to work is called a participants group, and is represented by another EDML file.
When inserting a server behavior into a document, Dreamweaver needs to know where to insert each code block, what each code block looks like, and what data must be entered by the user or replaced at runtime. Each single participant EDML file stores its own information, and the participants group EDML file lists all the participants that make up the server behavior.
Creating a Generic CFML Form Mailer Server Behavior Using the Dreamweaver Server Behavior Builder, you are now going to create a generic ColdFusion-driven Form Mailer. A Form Mailer is used to process and send all the fields of an HTML form to a specified address as an e-mail.
Before considering turning code into a server behavior, make sure it is bug free and fully tested. Inserting a buggy server behavior into your pages will cause all kinds of problems that will be difficult to debug. In addition to this, make sure that the code you want to be available as a server behavior is really suitable; if it doesn’t accept parameters or cannot be easily reused, it is not the right candidate for a server behavior. Code blocks that need no or few parameters to be entered should instead be turned into snippets, as we will see in the next chapter.
This chapter is from ColdFusion Web Development with Macromedia Dreamweaver MX 2004, by Jen and Peter deHaan et al. (Apress, 2004, ISBN: 1-59059-237-9). Check it out at your favorite bookstore today.
Buy this book now. |
Next: Build Server Behavior Code and Interface >>
More Web Authoring Articles
More By Apress Publishing