Defining the new server behavior, Defining the code to insert – Adobe Extending Dreamweaver CS4 User Manual

Page 255

Advertising
background image

249

EXTENDING DREAMWEAVER CS4

Server behaviors

Defining the new server behavior

Note: If the Server Behaviors panel is not open and visible, select the Window > Server Behaviors menu option.

1

In the Server Behaviors panel, select the Plus (+) button, and then select the New Server Behavior menu option.

2

In the New Server Behavior dialog box, select Document Type: ASP JavaScript, and Name: Hello World. (Leave the
“Copy existing server behavior” check box unchecked.)

3

Click OK.

Defining the code to insert

1

Select the Plus (+) button for Code Blocks to Insert.

2

In the Create A New Code Block dialog box, enter Hello_World_block1 (Dreamweaver might automatically enter
this information for you).

3

Click OK.

4

In the Code Block text field, enter <% Response.Write(“Hello World”) %>.

5

In the Insert Code pop-up menu, select Relative To The Selection so the user can control where this code goes in
the document.

6

In the Relative Position pop-up menu, select After The Selection.

7

Click OK.

In the Server Behaviors panel, you can see that the Plus (+) menu contains the new server behavior in the pop-up list.
Also, in the installation folder for your Dreamweaver files, the Configuration/ServerBehaviors/ASP_Js folder now
contains the following three files:

The group file: Hello World.edml

The participant file: Hello World_block1.edml

A script file: Hello World.htm

Note: If you are working in a multiuser configuration, these files appear in your Application Data folder.

Scenarios in which the server behavior API functions are
called

The server behavior API functions are called in the following scenarios:

The

findServerBehaviors()

function is called when the document opens and again when the participant is

edited. It searches the user’s document for instances of the server behavior. For each instance it finds, the

findServerBehaviors()

function creates a JavaScript object, and uses JavaScript properties to attach state

information to the object.

If it is implemented, Dreamweaver calls the

analyzeServerBehavior()

function for each behavior instance that

is found in the user’s document after all the

findServerBehaviors()

functions are called.

Advertising
This manual is related to the following products: