Generating Content in the Code View


Although Dreamweaver makes it extremely easy to create and format new content with the Design view, you can also use the Code view to easily manipulate your exiting code or create new code. In addition, Dreamweaver incorporates some nice features that make it easy to work in the Code view.

Collapsible Code Blocks

A new feature in Dreamweaver 8 that definitely makes coding a bit easier is the capability to hide blocks of code that you may not be working on. That way, you can focus on a specific section of code without having to wade through the entire document's code. To hide a code block, select the code that you want to hide and click the minus sign next to the line number. With the code block hidden, the line numbering jumps and a code block placeholder is displayed (shown in Figure 22.38).

Figure 22.38. A block of code has been collapsed and hidden from view.


Indenting Code Blocks

When developing complex code, proper indenting can make a tremendous difference in understanding the workflow of what is happening in the code. Statements such as if/then or While loops tend to be much easier to read and understand if they are indented properly. Rather than making you go through your code line by line and set up your indention, Dreamweaver makes it easy for you to follow an indention convention by selecting entire blocks of code and allowing you to indent the entire block.

To set the indention for a block of code, select the code and press the Tab key to indent to the right or the Shift+Tab key combination to indent to the left.

Tag Hints

As you type code in Dreamweaver, the application works to help you. One handy feature is the code hint drop-down that appears when you type code that Dreamweaver recognizes. For instance, if you type <%Response. in the Code view, Dreamweaver recognizes that you are going to use one of the VBScript Response functions and displays a drop-down with the available functions. From there you can click the down arrow to move through the list (see Figure 22.39) and select the appropriate function, or use the mouse to click on the correct one.

Figure 22.39. The code hint drop-down helps you choose the appropriate code.


Auto Tag Completion

Many HTML tags require both an opening and a closing tag. To save you time and typing, Dreamweaver includes an auto tag completion feature that automatically adds the closing tag after the opening tag has been completed and the closing tag has been started. For instance, if you place your cursor in the code view, and type <div> and then type </, Dreamweaver automatically closes the tag for you by adding the div> to the end of the tag.

If you would prefer to have Dreamweaver create the entire close tag after you type the opening tag, you can set this preference by choosing Edit, Preferences from the menu bar and clicking the Code Hints category. You can also turn off the auto completion feature in this category.

Code Colors

Another Dreamweaver feature that comes in handy when authoring code is Code Coloring. This feature modifies the color of the code depending on what type of code Dreamweaver perceives it to be. Depending on what type of document you are working in, you can customize the colors of the various types of code you are working with.

For instance, if you are developing an ASP page that contains HTML, VBScript, and JavaScript, you can adjust the colors of each type of code (and their subtypes). To adjust the default code coloring, open the Code Color category in the Preferences dialog box (Edit, Preferences) and double-click on any document type. From there you can adjust the various subtypes within that document and their code colors.



Special Edition Using Macromedia Studio 8
Special Edition Using Macromedia Studio 8
ISBN: 0789733854
EAN: 2147483647
Year: 2003
Pages: 337

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