One convention is to name code blocks as follows:
NameOfBehavior
_NameOfBlock
Here is an example:
MoveToRecord_Init
The runtime code must be a single tag block or script block. If you need to insert multiple tags or script blocks, split them into separate code blocks. You can also copy and paste code from other pages.
For more information, see the following sections:
Code blocks are inserted relative to tags in the page or relative to a tag selected by the page designer. For more information, see Positioning code blocks.
Once you specify the source code and insert location for each code block, the server behavior is completely defined. In most cases, you dont need to specify any additional information.
If you are an advanced user, you may want to modify additional parameters by clicking the Advanced button in the Server Behavior Builder. The builder expands to display several new options.
Identifier specifies whether or not the code block should be treated as an identifier.
By default, every code block is an identifier. If Dreamweaver finds an identifier code block anywhere in a document, it lists the behavior in the Server Behaviors panel. Use the Identifier checkbox to specify whether the code block should be treated as an identifier.
At least one of the server behaviors code blocks must be an identifier. A code block should not be an identifier if one of the following conditions applies: the same code block is used by some other server behavior; or the code block is so simple that it might occur naturally on the page.
Server Behavior Title specifies the title of the behavior in the Server Behaviors panel.
When the page designer clicks the Plus (+) button on the Server Behaviors panel, the new server behaviors title will appear in the pop-up menu. When a designer applies an instance of a server behavior to a document, the behavior appears in the list of applied behaviors in the Server Behaviors panel. Use the Server Behavior Title text box to specify the contents of the Plus (+) pop-up menu and the list of applied behaviors.
The initial value in the box is the name you supplied in the New Server Behavior dialog box. As parameters are defined, the name is automatically updated so that the parameters appear inside parentheses after the server behavior name.
Set Session Variable (@@Name@@, @@Value@@)
If the user accepts the default value, everything before the parentheses will appear in the Plus (+) pop-up menu (for example, Set Session Variable). The name plus the parameters will appear in the list of applied behaviors--for example, Set Session Variable ("abcd", "5").
Code Block to Select specifies what code block is selected when the user selects the behavior in the Server Behaviors panel.
When you apply a server behavior, one of the code blocks within the behavior is designated the "code block to select." If you apply the server behavior and then select the behavior in the Server Behaviors panel, in the Document window Dreamweaver automatically selects the designated block. By default, Dreamweaver selects the first code block that is not above the html
tag. If all the code blocks are above the html
tag, then Dreamweaver selects the first one. Advanced users can specify which code block is the selected one.
Dreamweaver creates the server behavior with no dialog box. The new server behavior appears in the Plus (+) menu of the Server Behaviors panel.
For more information, see Creating a dialog box for a custom server behavior.