Section 21.5. Viewing Live Data

21.5. Viewing Live Data

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 isin this example, the database column prodID from a recordset named rsProductbut 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 actually shows up as multiple rows or records when someone views it 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, as shown in Figure 21-15.

To turn the Live Data view on or off, click the Live Data View button on the toolbar, choose View Live Data, or press Ctrl+Shift+R ( -Shift-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 21-15), complete with tools for refreshing the displayed data, changing settings for the Live Data view, and adding URL parameters to test recordset filters.


Note: If you're using Microsoft's IIS Web Server, you may get an error when you turn on Live Data view. This means there's a permissions problem that prevents IIS from controlling the database. You can find instructions for fixing this problem on Windows 2000 at www.webwizguide. info /asp/faq/server_permissions.asp. Windows XP users can find instructions at www.sawmac.com/dw8.

With the Live Data view turned on, it's much easier to see what your page looks 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 on Section 21.2.1.

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, as you can see in Figure 21-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 datain this example, "Crop Ovals and Other Lesser-Known Alien Visitations"and apply the style to it. To see the style applied to the other records, click the Refresh button in the Live Data View toolbar.

Figure 21-15. This is the Live Data view of the dynamic table pictured in Figure 21-10. In Live Data view, you can update the data displayed on the page by clicking the Refresh Live Data view 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 longor if when switching into Live Data view, Dreamweaver seems to have stopped workingyou can click the Stop Live Data Update button to halt the current update.

21.5.1. Live Data View Settings

Some recordsets depend on information provided by a form or URL. Often 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 21-15) .

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

  2. Click 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 on Section 21.1.4).

  3. Click 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, 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 21-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.


Note: 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 21-15) to see how the page reacts with different offset values.
Figure 21-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 the application server executes before 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 23.2.7).



Dreamweaver 8[c] The Missing Manual
Dreamweaver 8[c] The Missing Manual
ISBN: 596100566
EAN: N/A
Year: 2006
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net