Using the Server Behavior Builder

Using the Server Behavior Builder

The Server Behavior Builder lets you add the code block or blocks that the behavior inserts into a page.

To write server behavior code blocks:

  1. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select New Server Behavior from the pop-up menu.

    The New Server Behavior dialog box appears.

    This is a picture of the feature being described.

  2. From the Document Type pop-up menu, select the document type that you are developing the server behavior for.
  3. In the Name text box, enter a name for the server behavior.
  4. If you want to copy an existing server behavior to add to the behavior you are creating, select the Copy Existing Server Behavior checkbox.

    When this checkbox is selected, a list of available server behaviors is displayed in the Behavior to Copy pop-up menu.

  5. Click OK.

    The Server Behavior Builder dialog box is displayed.

    This is a picture of the feature being described.

  6. To add a new code block, click the Plus (+) button.

    The Create a New Code Block dialog box is displayed.

    This is a picture of the feature being described.

  7. Enter a name for the code block you want to create and click OK.

    The name you entered in the dialog box appears in the Server Behavior Builder, with the appropriate scripting tags visible in the Code block text box.

    This is a picture of the feature being described.

  8. In the Code Block text box, enter the code necessary to implement the server behavior.

    When entering code in the Code Block text box:

    • You can insert only a single tag or code block for each named code block (for example, myBehavior_block1, myBehavior_block2, myBehavior_blockn, etc.). If you need to enter multiple tags or code blocks, you must create an individual code block for each using the Server Behavior Builder.
    • To include runtime parameters in a code block:
    1. Place the insertion point in the code block where you’d like to insert the parameter.
    2. Click the Insert Parameters in Code Block button.

      The Insert Parameters in Code Block dialog box appears.

    3. Enter a name for the parameter in the Parameter Name text box.
    4. Click OK.

      The parameter name is inserted in the code block.

    • Repeat steps 6 through 8 for each new code block you want to create.
  9. In the Parameter Name pop-up menu, enter a name for the parameters, and click OK.

    The parameter is inserted into the code block at the location where you placed the insertion point prior to defining the parameter.

  10. Select an option from the Insert Code pop-up menu specifying the location in which to embed the code blocks.

    For more information see Positioning code blocks.

  11. You can specify additional information about the server you are creating by using the Advanced options panel.
  12. Click the Advanced button to display more options.

    This is a picture of the feature being described.

  13. If you need to create more code blocks, repeat steps 7 through 13 as needed.
  14. If the server behavior requires that parameters be supplied to it, you will need to create a dialog box that accepts parameters from the person applying the behavior.

    To create a dialog box that accepts user input parameters, see Creating a dialog box for a custom server behavior.

  15. After you have performed the above steps as required by the server behavior you are creating, Click OK.

    Once you create a server behavior, it is listed in the Server Behaviors panel. Test the server behavior and ensure that it functions properly.

Related topics

  • Positioning code blocks
  • Repeating code blocks
  • Coding guidelines
  • Positioning code blocks
  • Using parameters in server behaviors


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