A simple server behavior example

 < Day Day Up > 

This example shows the process of creating a new server behavior so you can see the files that Dreamweaver generates and how to handle them. For details about working with the Server Behavior Builder interface, see "Adding Custom Server Behaviors" in Getting Started with Dreamweaver The example displays "Hello World" from the ASP server. The Hello World behavior has only one participant (a single ASP tag) and does not modify or add anything else on the page.

To create the behavior, you perform the following steps:

  • Creating the dynamic page document

  • Defining the new server behavior

  • Defining the code to insert

Creating the dynamic page document

First, you create a new ASP document.

To create a new dynamic page document:

1.

In Dreamweaver, select the File > New menu option.

2.

In the New Document dialog box, select Category: Dynamic Page and Dynamic Page: ASP JavaScript

3.

Click Create.

Defining the new server behavior

Next, you define the new server behavior.

To use the Server Behavior Builder to define your 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" checkbox unchecked.)

3.

Click OK.

Defining the code to insert

Finally, you define the code to insert.

To define 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.


     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net