Dreamweaver

Use the Server Behavior Builder

Use the Server Behavior Builder to add the code block or blocks that the behavior inserts into a page.

  1. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button, and select New Server Behavior.
  2. From the Document Type pop‑up menu, select the document type that you are developing the server behavior for.
  3. In the Name box, enter a name for the server behavior.
  4. (Optional) To copy an existing server behavior to add to the behavior you are creating, select the Copy Existing Server Behavior option, and then select the server behavior in the Behavior to Copy pop‑up menu. Click OK.

    The Server Behavior Builder dialog box is displayed.

  5. To add a new code block, click the Plus (+) button, enter a name for the code block, and click OK.

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

  6. In the Code Block box, enter the run-time code necessary to implement the server behavior.
    Note: When entering code in the Code Block box, you can only insert a single tag or code block for each named code block (for example, myBehavior_block1, myBehavior_block2, myBehavior_blockn, etc.). If you have to enter multiple tags or code blocks, create an individual code block for each one. You can also copy and paste code from other pages.
  7. Place the insertion point in the code block where you’d like to insert the parameter, or select a string to replace with a parameter.
  8. Click the Insert Parameters in Code Block button.
  9. Enter a name for the parameter in the Parameter Name box (for example, Session), 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. If you selected a string, every instance of the selected string in the code block is replaced with a parameter marker (for example, @@Session@@).

  10. Select an option from the Insert Code pop‑up menu specifying where to embed the code blocks.
  11. (Optional) To specify additional information about the server behavior, click the Advanced button.
  12. To create more code blocks, repeat steps 5 through 11.
  13. If the server behavior requires that parameters be supplied to it, you must create a dialog box that accepts parameters from the person applying the behavior. See the link below.
  14. After you perform the required steps to create the server behavior, click OK.

    The Server Behaviors panel lists the server behavior.

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