Previous Section  < Day Day Up >  Next Section

22.5 Viewing Live Data Within Dreamweaver

After you add dynamic information to a Web page, you see something like this in the document window: {rsProducts.prodID}. It gives you an idea of what the information is梚n this example, the database column prodID from a recordset named rsProducts 梑ut it doesn't show any real database information, which can make designing a page more difficult. You're especially far from seeing the actual result when a page contains a repeating region: What appears as a single row of dynamic text will actually appear as multiple rows or records when viewed in a Web browser.

Fortunately, you can preview a page with real database records directly in Dreamweaver. In addition to Design view and Code view, Dreamweaver includes a view for working with dynamic information: Live Data view. When viewing a dynamic page in Live Data view, Dreamweaver contacts the testing server, retrieves recordset data from the database, and displays it in the document window (see Figure 22-15).

This is the Live Data view of the dynamic table pictured in Figure 22-10. In Live Data view, you can update the data displayed on the page by clicking the Refresh button. Turn on Auto Refresh if you want Dreamweaver to update the Live Data view automatically whenever you make a change to a dynamic element of the page (but avoid it if your connection to the testing server is slow). Also, if refreshing the data takes too long梠r when switching into Live Data view, Dreamweaver seems to have stopped working梱ou can click the Stop Live Data Update button to halt the current update.

To turn Live Data view on or off, click the Live Data View button on the toolbar, choose ViewLive Data, or press Ctrl+Shift+R (Shift-figs/command.jpg-R). It may take a few seconds for the document window to change, since Dreamweaver must contact the testing server and retrieve information from the database. After a moment, the Live Data toolbar appears (see Figure 22-15), complete with tools for refreshing the displayed data, changing settings for Live Data view, and adding URL parameters to test recordset filters.

With Live Data view turned on, it's much easier to see what your page will look like when viewed on the Web. You can continue to work on a Web page in this view just as you would in Design view. You can add text and graphics, modify page properties, and even format dynamic data as described in Section 22.2.2.

However, when you're working with a repeating region, you can only select, delete, or format the first set of dynamic data items. For instance, following Figure 22-15, a dynamic table displays repeating rows of database records. If you wanted to apply a Cascading Style Sheet style to the name of each product listed, you would click the item in the first row of dynamic data梚n this example, "Crop Ovals and Other Lesser- Known Alien Visitations"梐nd apply the style to it. To see the style applied to the other records, click the Refresh button in the Live Data View toolbar.

22.5.1 Live Data View Settings

Some recordsets depend on information provided by a form or URL. When you use the filter option, for instance, a recordset searches a database for records that match information from a form or URL.

This feature can come in handy for pages that provide detailed information about a single record. Frequently for these types of pages, the URL might appear something like this: details.asp?prodID=38, where the name of the page (details.asp) is followed by a URL parameter that includes a name (prodID) and value (38). The recordset then looks for the product whose ID (prodID) matches 38.

Because pages like this can't show up properly without a little outside help, you need to provide extra information in the Live Data View Setting window, like this:

  1. In the Live Data toolbar, click the Settings button (see Figure 22-15).

    You can also choose ViewLive Data Settings. Either way, the Live Data Settings window appears (Figure 22-16).

The Live Data Settings window lets you define information that the dynamic page needs to operate correctly. For example, the page may include a recordset that uses information contained in the URL to search records in a database. The Initialization Script section of the window stores temporary code that will be executed by the application server prior to viewing the page in Live Data view. Use this advanced option for setting the session and application variables that the application server uses to process the page (see Section 24.2.7).
  1. Click the + button to add a new name and value pair.

    Dreamweaver refers to this as a URL Request, but essentially it means either a form variable (Section or a URL parameter (Section

  2. Click in the Name column and type a name for the new URL Request item.

    If the URL Request is being used to filter data in a recordset, you would use the name you used when you created the filter in the Recordset window (see step 5 in Section

  3. Click in the Value column and type a value.

    This may be a number or text, but the value must retrieve at least one record from the database, according to the filter options you set up in the recordset. For example, if you created a filter to find products under a certain price, you might type price as the name of the URL request and 10 as its value.

  4. From the Method menu, select either GET or POST.

    If the filter in your recordset uses a form variable (Section, select POST; if the filter uses a URL parameter, select GET.

  5. Click OK to close the Live Data Setting window.

    If you haven't turned on the Auto Refresh button, you must click the Refresh button in the Live Data toolbar (see Figure 22-15) to see the new results. In addition, if you selected the GET method in step 5, a URL Parameter box appears in the Live Data toolbar. You can change the values of the URL parameter directly in this box.

The Recordset Navigation Bar and Status message objects react differently, depending on which records in a recordset are displayed. To see this effect in action, add a new URL request item named offset in the Live Data Settings window. Set the value to something other than 1. Click OK to return to the Live Data view. You can change this value directly in the URL parameter box in the Live Data View toolbar (see Figure 22-15) to see how the page reacts with different offset values.

    Previous Section  < Day Day Up >  Next Section