Accessibility
 
Home > Products > UltraDev > Support > Extending Dreamweaver UltraDev
Dreamweaver UltraDev Icon Macromedia Dreamweaver UltraDev Support Center - Extending Dreamweaver UltraDev
1. Write the run-time code and test it

For the first example, imagine a simple ASP (Active Server Pages) server behavior that sends the user to a different page if a recordset is empty. This example has only one participant (a single ASP tag) and will not modify or add anything else on the page. It will depend on the existence of recordsets.

Key Concepts

Test your run-time code on a real server
Ensure participants are uniquely identifiable
Determine parameters you'll need to read/write in each participant

In this first and most important step, you will write and test the run-time code; then, use this file as your test file throughout this exercise. Developers often start with a user interface, only to find that constraints on the run-time code changes the design completely. The run-time code you write must be easy to find and edit using regular expressions. Each participant must have a distinct node (a tag), with a unique signature.

The following example shows the run-time code in ASP/JavaScript :

<% 
  if (Recordset1.EOF) Response.Redirect("http://www.yahoo.com");
%>

This code has two changeable parameters: the recordset name and the URL. The job of your server behavior will be to gather these two bits of information from the user, plug them into the run-time code, and add this code to the correct location on the page. You can read and write these parameters using regular expressions.

Because this run-time code depends on a recordset, it must be positioned below the recordset definition code but above other code that may depend on the recordset being non-empty. This positioning is called "weight," which will be discussed in step 6.

To ensure that the run-time code works, perform the following steps:

1 Define a site with the ASP server model and the JavaScript server language.
2 Create a document in the site.
3 Define a recordset.
4 Preview your ASP page in a browser.
Once that's working, add the run-time code to the page above the <HTML> tag. For the sake of testing, add a second recordset, and a second copy of the run-time script. Your test document should now look like the sample file testRedirectIfEmpty.asp

After testing to ensure this run-time code works, you're ready for step 2.

To Table of Contents Back to Previous document Forward to next document