Positioning code blocks

Positioning code blocks

When you create code blocks using the Server Behavior Builder (see Using the Server Behavior Builder for more information), you must specify where to insert them in the page’s HTML code. The Insert Code and Relative Position pop-up menus let you choose where to insert the code block in the document, and then specify a position relative to another tag in the page.

To learn more about the code block positioning options and how they affect your custom server behavior, see Code block positioning within web pages.

To position a code block (general instructions):

  1. Using the Server Behavior Builder, write a code block according to the section Using the Server Behavior Builder.
  2. In the Server Behavior Builder dialog box, select a position in which to insert the code block from the Insert Code pop-up menu.
  3. In the Server Behavior Builder dialog box, select a position relative to that which you selected in the Insert Code pop-up menu.
  4. If you have completed the authoring of the code block, click OK.

    The server behavior is listed in the Server Behaviors panel (Window > Server Behavior), and can be viewed by clicking the click the Plus (+) button.

  5. Test the server behavior and ensure that it functions properly.

    See Testing server behaviors for more information.

To position a code block relative to another tag on the page:

  1. In the Insert Code pop-up menu, select Relative To a Specific Tag.
  2. In the Tag text box, enter the tag or select one from the pop-up menu.

    If you enter a tag, don’t include the angled brackets (< >).

  3. Specify a location relative to the tag by choosing an option in the Relative Position pop-up menu.

    You can insert your code block just before or just after the opening or closing tags. You can also replace the tag with the code, insert the code as the value of an attribute of the tag (a box appears to let you select the attribute), or insert the code inside the opening tag.

To position a code block relative to a tag selected by the page designer:

  1. In the Insert Code pop-up menu, select Relative To the Selection.
  2. Specify a location relative to the selection by choosing an option in the Relative Position pop-up menu.

    You can insert your code block just before or just after the selection. You can also replace the selection with your code block, or you can wrap the code block around the selection.

    If you want to wrap the code block around a selection, the selection must consist of an opening and closing tag with nothing in between, as follows:

    <CFIF Day="Monday"></CFIF>
    

    The opening tag piece of the code block is inserted before the selection’s opening tag and the closing tag piece of the code block is inserted after the selection’s closing tag.

Related topics

  • About custom server behaviors
  • Code block positioning within web pages
  • Using the Server Behavior Builder


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly