Using Dreamweaver to Write CFML

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Chapter E.  ColdFusion MX Tags and Beyond


ColdFusion is written in plain text, so you can use any text editor you like to write CFML even Notepad or Simpletext. However most developers can write code much faster and easier with a dedicated development environment. With the release of Dreamweaver MX, Macromedia no longer produces ColdFusion Studio, which was the tool used by designers to help code their ColdFusion pages. Instead, many of the features of ColdFusion Studio have been incorporated into Dreamweaver MX. This makes Dreamweaver the primary development environment for ColdFusion pages, with the ease of use provided by its visual tools, such as server behaviors, combined with some very powerful tools for hand-coding.

If you are used to using HomeSite, ColdFusion Studio, or another code-based editor, you may prefer the layout of the HomeSite/Coder-style workspace, with the panels docked on the left side, as shown in Figure E.2. This view of your pages echoes the layout of ColdFusion studio in previous ColdFusion versions. To get this workspace, choose Edit, Preferences, and the General category. Then click the button marked Change Workspace. Select the HomeSite/Coder-style workspace option.

Figure E.2. The HomeSite/Coder-style workspace may be more comfortable to previous users of HomeSite or ColdFusion Studio.

graphics/efig02.jpg

If you still cannot bear to stop using ColdFusion Studio, take a look at HomeSite+. HomeSite+ is a code-only editor, combining HomeSite and ColdFusion studio with support for the latest ColdFusion MX features. A copy of HomeSite+ is included on the Dreamweaver MX CD. HomeSite+ is discussed in a little more detail in Appendix B, "Server Behavior Builder."

Most of us, however, will want to develop ColdFusion pages in Dreamweaver, and there are some great tools to help you do so.

Design View

One of the biggest frustrations for teams of Web developers is the interaction between Web designers and application developers. The Web designers may be given pages that don't fit in with the overall site appearance, but because so many elements depend on the output from server-side code, they are unable to envision what the page will finally look like.

The application developers will then complain that the designers have altered their code making the page inoperable! With Dreamweaver, the designers and the developers can share a common environment, each seeing what the other is trying to achieve.

The design view, which most Web designers will do a lot of their work in, also shows the CFML on the page visually, so if Web designers are altering the visual layout of the page, they can see the CFML tags and avoid altering them, even if they don't understand them.

Using the design view also enables the application developers to code up the page appearance and layout very quickly. You can quickly produce prototypes of the pages for your boss, leaving the final page layout to the designers.

Server Behaviors

Using server behaviors lets Web designers build simple Web applications using only visual tools. Database query and result pages, navigating through pages of returned data, database updates and inserts, and user authentication can all be built without writing a single line of CFML code. The application developers can concentrate on the difficult functionality of the site and advanced features.

Using the server behaviors in Dreamweaver is a also great way to learn how to write CFML. The ColdFusion code written out by Dreamweaver is quite straightforward and easy to follow. Using the code produced by Dreamweaver, you can add, change, and take away bits of code, and then study the effect on the page.

Code View

When you need to develop pages that move beyond the server behaviors, you will mostly be using the code view. Code view shows you just the HTML, JavaScript and server-side code in the page. You see every detail of the code, but it's difficult to see how the final page will look. You can set up a lot of your own preferences of how you like to work in code view. Clicking the View Options button on the document toolbar pops up a small menu from which the options can be toggled on or off by selecting them, as seen in Figure E.3. You can also find these options by choosing the View menu, Code View options. These options are shown in Table E.2.

Figure E.3. You can change the options available to you in code view to help you hand code your CFML pages.

graphics/efig03.jpg

Table E.2. Code View Options
Option Description
Word Wrap Automatically wraps code onto the next line, but does not insert a new line or carriage return character.
Line Numbers Displays line numbers along the left side of the code screen. A line with no number is wrapped from the previous line.
Highlight Invalid HTML Highlights (in yellow) any HTML code Dreamweaver does not recognize.
Syntax Coloring This colors your code so it is easier to differentiate between variables, strings, CFML tags, tag attributes, and so on. Very useful for spotting errors before running the page.
Auto Indent If enabled, the next line is indented the same as the previous line. Otherwise, every new line starts at column 1.


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net