|MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA|
Dreamweaver: A Visual Tool for Serious Web Codersby Bruce A. Epstein, coauthor of Dreamweaver in a Nutshell
With over 20 years of programming experience, I am skeptical of visual Web development environments.
This article will explore several of Dreamweaver's advanced features for hardcore Web developers:
Hand Coding in Dreamweaver
Why use Dreamweaver if you prefer to hand-code your HTML? Dreamweaver lets you hand-code HTML, but it also adds site management, document management, and other time-saving tools. You can even use regular expressions to search and replace tags throughout your entire site. To hand-code your HTML, simply open Dreamweaver's Code view (View->Code). You can preview the page in Dreamweaver's Design view (View->Design) or view both source and output simultaneously in Code and Design view. You can preview your page in a browser using F12.
Using an External Editor
Although Dreamweaver 4 has an integrated HTML editor, it is bundled with two popular HTML text editors: BBEdit on the Macintosh and HomeSite on Windows. You can specify your favorite text editor under Edit->Preferences->File Types/Editors->External Code Editor. Your chosen text editor appears under Dreamweaver's Edit menu and can be accessed using Edit->Edit with YourEditorName, Ctrl+E (Windows), or Cmd+E (Macintosh).
Macromedia prides itself on Dreamweaver's so-called Roundtrip HTML, meaning that Dreamweaver doesn't muck with your HTML (or other code) unless you want it to. But you won't find a "Roundtrip HTML" command anywhere in Dreamweaver's UI. Instead, Dreamweaver sports a handful of preferences and commands that let you control exactly how your code is or isn't reformatted.
Controlling HTML Code Rewriting
You can control how and when Dreamweaver rewrites HTML code using the options under Edit->Preferences->Code Rewriting. Options include fixing invalidly nested and unclosed tags, removing extra closing tags, and encoding special characters using %, and encoding of the <, >, &, and " characters. Best of all, you can specify the types of files for which Dreamweaver should never rewrite the code. The default file types are .asp, .cfm, .cfml, .ihtml, .js, .jsp, .php, and .php3, but you can add your own file extensions, such as .php4. To prevent Dreamweaver from ever rewriting any HTML code, simply add the .html and .htm extensions to the list of file types never to be rewritten. (You can specify the default file extension, .html or .htm, for HTML files under Edit->Preferences->General->Add Extension When Saving.)
You can control whether Dreamweaver overrides the case for your tags and attributes separately using the Override Case of Tags and Override Case of Attributes options under Edit->Preferences->Code Format. If you enable these options, Dreamweaver will change the case of your tags and attributes according to the preferences set under Edit->Preferences->Code Format.
Dreamweaver can clean up HTML generated by other programs. Its Cleanup Word HTML command lets you strip out unwanted HTML generated by Microsoft Word. A free extension lets you clean up FrontPage HTML in a similar manner.