Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Server Behaviors Tom Muck co-author Building Dreamweaver 4 and Dreamweaver UltraDev 4 Extensions.

Similar presentations


Presentation on theme: "Building Server Behaviors Tom Muck co-author Building Dreamweaver 4 and Dreamweaver UltraDev 4 Extensions."— Presentation transcript:

1 Building Server Behaviors Tom Muck co-author Building Dreamweaver 4 and Dreamweaver UltraDev 4 Extensions

2 The Dreamweaver Extensibility Model Objects Objects Behaviors Behaviors Commands Commands Server Behaviors Server Behaviors Data Sources Data Sources Toolbars Toolbars

3 Server Behaviors Used to insert code that needs to be processed at the Server Used to insert code that needs to be processed at the Server Important to the integration of custom code into the Dreamweaver environment Important to the integration of custom code into the Dreamweaver environment Supported for all of the Dreamweaver Server Models Supported for all of the Dreamweaver Server Models ASP, PHP, CF, JSP, ASP.NET ASP, PHP, CF, JSP, ASP.NET Can include one or more models Can include one or more models

4 Constructing Server Behaviors Assemble working code Assemble working code Build the Server Behavior Build the Server Behavior Hand Coding Hand Coding The Server Behavior Builder The Server Behavior Builder Test the Server Behavior Test the Server Behavior Package and Distribute the Server Behavior Package and Distribute the Server Behavior

5 The Server Behavior Builder Designed to simplify the addition of custom Server Behaviors Designed to simplify the addition of custom Server Behaviors Requires that you know two things Requires that you know two things The final code needed to do the job The final code needed to do the job Where the code needs to go Where the code needs to go Handles the construction of the various functions within a Server Behavior Handles the construction of the various functions within a Server Behavior Has significantly increased the number of available behaviors Has significantly increased the number of available behaviors

6 Response.Redirect Server Behavior Assemble the working code Assemble the working code Construct the Server Behavior Construct the Server Behavior Touring the Server Behavior BuilderTouring the Server Behavior Builder Testing the Server BehaviorTesting the Server Behavior Packaging and Distributing the Server Behavior Packaging and Distributing the Server Behavior MXI files MXI files MXP files MXP files The Dreamweaver Exchange The Dreamweaver Exchange

7 A Conditional Region Server Behavior More complex code More complex code Requires multiple code blocks Requires multiple code blocks Can be applied to a variety of objects Can be applied to a variety of objects Can be built to check for a number of conditions Can be built to check for a number of conditions

8 Part 2 Going Beyond the Server Behavior Builder

9 Limitations of the SBB Doesn’t provide input validation Doesn’t provide input validation Creates regular expressions that match the code exactly -- no fuzzy matches possible Creates regular expressions that match the code exactly -- no fuzzy matches possible Doesn’t manipulate the selection Doesn’t manipulate the selection

10 SBB-generated Server Behaviors Can Be Extended SBB builds HTML, JS, and XML extensions -- no mystery here. They can be extended. SBB builds HTML, JS, and XML extensions -- no mystery here. They can be extended. SBB files located in three places: SBB files located in three places: HTML files located in ServerBehaviors folder HTML files located in ServerBehaviors folder XML files located in ServerBehaviors folder XML files located in ServerBehaviors folder Controls located in Shared > Controls > Scripts folder Controls located in Shared > Controls > Scripts folder

11 Structure of a Server Behavior initializeIU() -- initializes all controls initializeIU() -- initializes all controls canApplyServerBehavior() -- can the SB be applied? canApplyServerBehavior() -- can the SB be applied? findServerBehaviors() -- finds instances of the SB on the page findServerBehaviors() -- finds instances of the SB on the page applyServerBehavior() -- applies the SB to the page applyServerBehavior() -- applies the SB to the page A Server Behavior is an HTML document with JavaScript functions, API calls, and XML participants

12 Structure of a Server Behavior - pt 2 More API functions More API functions inspectServerBehavior() -- take the SB apart and populate the interface deleteServerBehavior() -- delete the SB analyzeServerBehavior() -- is the SB whole?

13 API Functions Not Implemented copyServerBehavior() copyServerBehavior() pasteServerBehavior() pasteServerBehavior() With these two functions defined in your SB, you can copy and paste Server Behaviors between pages. With these two functions defined in your SB, you can copy and paste Server Behaviors between pages. Not implemented, but fully documented in the Extending DW and Dreamweaver documents. Not implemented, but fully documented in the Extending DW and Dreamweaver documents.

14 Input Validation Generic JavaScript routines can be written to use in your extensions Generic JavaScript routines can be written to use in your extensions Best place to put the validation -- applyServerBehavior() Best place to put the validation -- applyServerBehavior() Use the errStr to create an error message -- this will stop the SB from being applied Use the errStr to create an error message -- this will stop the SB from being applied Benefits of validation Benefits of validation Pitfalls of validation Pitfalls of validation

15 Pitfalls of Validation Example: Adding a color to a Server Behavior Example: Adding a color to a Server Behavior Can your color look like this? Can your color look like this? #00FF00 #00FF00 Can your color look like this? Can your color look like this? #00ff00 #00ff00 How about this? How about this? Red Red

16 Pitfalls of Validation Or this? Or this? #Recordset1.UserColorPref# #Recordset1.UserColorPref# Or this? Or this? Answer: Answer: There is no way to validate for every user and every situation. You can’t predict how someone else will use your extension or how you will use it in the future. There is no way to validate for every user and every situation. You can’t predict how someone else will use your extension or how you will use it in the future.

17 canApplyServerBehavior() -- How to Take Advantage of It What does your SB need as a prerequisite? What does your SB need as a prerequisite? How do you find out if the page has what it needs? How do you find out if the page has what it needs? Thinking ahead. Can this function come back to haunt you? Thinking ahead. Can this function come back to haunt you?

18 Other Dreamweaver Extensions: Server Formats Server Formats Server Models Server Models Translators Translators Connections Connections Server Behavior Builder Controls Server Behavior Builder Controls Data Sources Data Sources

19 Server Formats -- Located in the ServerFormats folder Adds a format or function to a server expression Adds a format or function to a server expression Examples: Examples: Money formatting Money formatting Time formatting Time formatting Removing or replacing characters Removing or replacing characters These require that a regular expression to be written inside of the Formats.xml file These require that a regular expression to be written inside of the Formats.xml file

20 Translators New format for Dreamweaver MX New format for Dreamweaver MX Different than Dreamweaver Translators Different than Dreamweaver Translators -- XML architecture -- XML architecture Located in the ExtensionData > MM > Translations folder Located in the ExtensionData > MM > Translations folder

21 Connections Connections are extensible also Connections are extensible also JDBC Drivers can be easily added JDBC Drivers can be easily added

22 Server Behavior Builder Controls SBB is extensible SBB is extensible Controls available on the Web Controls available on the Web Files located in Files located in Configuration > Shared > Controls > String Menu Configuration > Shared > Controls > String Menu Configuration > Shared > Controls > Scripts Configuration > Shared > Controls > Scripts Remember to include the JS file in your extension Remember to include the JS file in your extension

23 Data Sources Many possibilities for new extensions Many possibilities for new extensions COM objects COM objects CF Tags CF Tags ASP Objects ASP Objects Shopping Carts Shopping Carts These are complex extensions tied in with Server Behaviors and Commands These are complex extensions tied in with Server Behaviors and Commands


Download ppt "Building Server Behaviors Tom Muck co-author Building Dreamweaver 4 and Dreamweaver UltraDev 4 Extensions."

Similar presentations


Ads by Google