1 / 23

Building Server Behaviors Tom Muck co-author Building Dreamweaver 4 and

Building Server Behaviors Tom Muck co-author Building Dreamweaver 4 and Dreamweaver UltraDev 4 Extensions. The Dreamweaver Extensibility Model. Objects Behaviors Commands Server Behaviors Data Sources Toolbars. Server Behaviors.

adli
Download Presentation

Building Server Behaviors Tom Muck co-author Building Dreamweaver 4 and

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

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

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

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

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

  7. A Conditional Region Server Behavior • More complex code • Requires multiple code blocks • Can be applied to a variety of objects • 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 • Creates regular expressions that match the code exactly -- no fuzzy matches possible • 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 files located in three places: • HTML files located in ServerBehaviors folder • XML files located in ServerBehaviors folder • Controls located in Shared > Controls > Scripts folder

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

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

  13. API Functions Not Implemented • copyServerBehavior() • pasteServerBehavior() • 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.

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

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

  16. Pitfalls of Validation • Or this? • <cfoutput>#Recordset1.UserColorPref#</cfoutput> • Or this? • <%=(rsGetUserPrefs.Fields.Item("bgcolor").Value)%> • 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.

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

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

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

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

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

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

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

More Related