Displaying the Results

Chapter 8 - Creating a Search System
byGareth Downes-Powellet al.
Wrox Press 2003

OK, so we've generated the code that searches through the database, but we still need to display those results to the user. Select the Bindings tab in the Application panel. You should find your recordset rsSearch:

click to expand

If the recordset tree is not expanded, click on the + icon next to it. This will expand the recordset to show the column names.

Inserting Dynamic Values into the Page

We're going to display the results to our users in a table, with the cells populated by the values contained in the recordset. Create a new table in your document with two rows and four columns. The first row contains the column headings, so fill those in as per the screenshot below.

To make the rest of the cells display the values in the recordset, select the ID column of the rsSearch recordset in the Bindings panel. Make sure your document cursor is place in the second row, first column, and then click the Insert button at the bottom of your Bindings panel. This will insert the dynamic value rsSearch.ID in your page. Repeat the same operation with the other values of the recordset in the other cells of the second row.

The page should look like this when you've finished:

click to expand

Repeating a Region

Now, all you have on your page is a single row of dynamic values, but it's likely that sometimes more than one result will be returned from the search system.

The very last step is to use the Repeat Region Server Behavior. First we need to select the region we want to repeat. To do that, place your cursor in one of the dynamic rows of your table. Then, at the bottom of the page, you have the Tag Selector list. Click on the tag <tr> that is at the most right position. This way you will select the whole row.

click to expand

Now, click on the Server Behaviors tab in the Application panel group.

click to expand

This panel shows you all the dynamic behaviors that are present in your document. You can see that the first dynamic element is your recordset, and after that come the Dynamic Text elements. These are those you have inserted in your table cell.

Now click on the + button, and select the Repeat Region menu item.

click to expand

You will then be asked to select the recordset you want to repeat, and to choose the option to either repeat all the values of the recordset or repeat only a fixed number of times. Choose to repeat all of the values of the recordset. Finally your document should look like this:

click to expand

You can see the little Repeat box above the cell that contains {rsSearch.ID} indicating that this part of your document is inside a Repeat Region.

Dreamweaver MX PHP Web Development
Dreamweaver Mx: Advanced Php Web Development
ISBN: 1904151191
EAN: 2147483647
Year: 2001
Pages: 88

Similar book on Amazon

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