Adobe 38040334 - Dreamweaver CS3 User Manual page 606

Pc
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

See also
"Use the Server Behavior Builder" on page 590
"Positioning a code block" on page 593
Retain the old and new versions of the behavior in the panel
Click the Plus (+) button on the Server Behaviors panel (Window > Server Behaviors), select New Server Behavior,
and create a copy of the old server behavior.
Edit the code of a server behavior created with the Server Behavior Builder
1
In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select Edit Server
Behaviors from the pop-up menu.
The Edit Server Behaviors dialog box displays all the behaviors for the current server technology.
Select the server behavior and click Edit.
2
3
Select the appropriate code block and modify the code, the parameter marks, or the position of the code block to
be inserted in pages.
If the modified code does not contain any designer-supplied parameters, click OK.
4
Dreamweaver regenerates the server behavior without a dialog box. The new server behavior appears in the Plus (+)
pop-up menu of the Server Behaviors panel.
If the modified code does contain designer-supplied parameters, click Next.
5
Dreamweaver asks you whether you want to create a new dialog box, overwriting the old one. Make your changes
and click OK.
Dreamweaver saves all changes in the server behavior's EDML file.
Coding guidelines
In general, your server behavior's code should be compact and robust. Web application developers are very sensitive
to the code added to their pages. Follow generally accepted coding practices for the document type's language
(ColdFusion, ASP.NET, JavaScript, VBScript, PHP, Visual Basic or Java). When writing comments, consider the
different technical audiences that might need to understand the code, such as web and interaction designers, or other
web application developers. Include comments that accurately describe the purpose of the code, and any special
instructions for including it within a page.
Keep in mind the following coding guidelines when you create server behaviors:
An important requirement. The server behavior's code should handle error cases gracefully. Try to
Error checking
foresee every possibility. For example, what if a parameter request fails? What if no records are returned from a
query?
Help to ensure that your code is clearly identifiable and avoids name collisions with existing code.
Unique names
For example, if the page contains a function called
your server behavior inserts code that uses those names too, the server behavior may conflict with the existing code.
Allow you to identify your own run-time functions and global variables in a page. One convention is
Code prefixes
to use your initials. Never use the
functions and global variables with the prefix
hideLayer()
prefix, as it is reserved for Macromedia use only. Macromedia preceded all
MM_
to prevent them from conflicting with any code that you write.
MM_
September 4, 2007
and a global variable called
ERROR_STRING
DREAMWEAVER CS3
599
User Guide
, and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents