Creating the For Sale Section


To build out the For Sale section of the site, you need to have two pages. The first displays all the motorcycles in the rsForSale recordset. Each motorcycle listed contains a hyperlink to a second details page that provides the user with additional details about that specific motorcycle.

Building the For Sale Dynamic Table

Displaying the motorcycles that are for sale can become a difficult task as the inventory grows. Before the advent of dynamic web pages, each entry would have been manually added to a table, which can quickly become a tedious task. Dreamweaver, however, provides an easy way to retrieve the motorcycles that are for sale from the database and display them in a dynamic table. To create a dynamic table, follow these steps:

1.

Place your cursor in the erTitle editable region. Type Motorcycles For Sale in the region. Highlight the text and click the Bold button on the Property inspector.

2.

Next, you need to place a dynamic table in the page content section. Delete the erPageContents placeholder text and place your cursor in the erPageContent editable region. Next, choose Insert, Application Objects, Dynamic Data, Dynamic Table from the menu bar.

3.

In the Dynamic Table dialog box (see Figure 30.11), choose the rsForSale recordset and choose to show 10 records at a time. Set a border for the table to 1, the cell padding to 0, and the cell spacing to 2. Click OK to create the table.

Figure 30.11. Add a dynamic table to your page.


4.

Select the table and choose Center in the Align field of the Property inspector. Select the top row in the new dynamic table and click the Align Center button and Bold button on the Property inspector.

5.

Lastly, you need to create a hyperlink that enables the user to click on the inventoryid and view additional details about the motorcycle. Select the inventoryid element in the first cell of the table and type forsale_details.cfm in the Link field of the Property inspector. Click the folder icon next to the Link field and then click the Parameters button in the Select File dialog box.

6.

In the Parameters dialog box (see Figure 30.12), type inventoryid in the Name field and click the lightning bolt icon in the Value field to choose a data binding.

Figure 30.12. Add the necessary parameter to be passed to the details page.


7.

In the Dynamic Data dialog box, expand the rsForSale recordset and select inventoryid. Click OK to close the dialog box and click OK again to close the Parameters dialog box. Click OK one more time to close the Select File dialog box and the hyperlink is created in the page. As shown in Figure 30.13, the inventoryid data binding is now a hyperlink to the forsaledetails page.

Figure 30.13. The inventoryid data binding is now a hyperlink.


8.

Save the page.

9.

Click the F12 button on your keyboard to preview the page in your browser. As shown in Figure 30.14, the page now contains a data table that lists the motorcycles that are for sale.

Figure 30.14. The database records are now visible in the page.


Creating the Details Page

The last step in creating the For Sale section of the site is to create a details page that shows additional information about the specific motorcycle the user has chosen.

1.

Create a new page based on the retros_cycles_template_final template. Change the page title to read "For Sale Details" and save the page as forsale_details.cfm.

2.

Place your cursor in the erTitle editable region and type Product Details, select the text, and click the Bold button on the Property inspector.

3.

Create a new recordset for the page by clicking the plus sign on the Server Behaviors panel and choosing Recordset from the menu. In the Recordset dialog box, shown in Figure 30.15, name the recordset rsDetails, choose the dsnRetrosCycles data source, and select the tbInventory table.

Figure 30.15. Create a new recordset.


4.

Next, select the following fields to be included in the recordset:

  • Year

  • Make

  • Model

  • Size

  • Color

  • ListPrice

5.

Set a filter on the recordset that selects only the record where inventoryid equals the URL Parameter inventoryid, as shown in Figure 30.16. Click OK to create the recordset.

Figure 30.16. Choose which fields will be included in the recordset and set the filter to retrieve only the appropriate record.


6.

Place your cursor in the erPageContent editable region and add a table to the page that contains six rows, two columns, and a width of 450 pixels. Set the border to 1, the cell padding to 2, and the cell spacing to 0. Click OK to insert the table, as shown in Figure 30.17.

Figure 30.17. A new table has been added to the page.


7.

In the left column of the table, add the following values in each of the six cells:

  • Year:

  • Make:

  • Model:

  • Size:

  • Color:

  • Price:

8.

Select the left column and click the Align Right and Bold buttons on the Property inspector. Set the width of the column to 50% by typing the value in the W field.

9.

For each of the labels in the left column, drag the appropriate data binding from the Bindings panel into the corresponding cell in the right column. When completed, your page should look like Figure 30.18.

Figure 30.18. Add the data bindings to the table.


10.

Select the listprice data binding and in the Bindings panel, scroll to the right, and drop down the format menu. From the menu, choose Currency, Dollar Format (see Figure 30.19).

Figure 30.19. Assign the appropriate format for the list price.


11.

Save the page.

12.

Switch to the forsale.cfm page in Dreamweaver and press the F12 key on your keyboard to preview the page in your browser. Click on any of the inventory IDs and you are directed to the forsale_details.cfm page with the corresponding details (see Figure 30.20). Click back to return to the original table and test the other links.

Figure 30.20. The page displays the appropriate details.


In this chapter, you have seen how to use a template created in Fireworks to create a Dreamweaver template and spawn child pages. In addition, you saw the process of creating recordsets that draw data from a database and created a set of pages that enable you to display items for sale and their corresponding details.

In the final section of the book, we take a look at how Contribute, Macromedia's content management tool, can be used to edit web pages without disrupting the site's structure.



Special Edition Using Macromedia Studio 8
Special Edition Using Macromedia Studio 8
ISBN: 0789733854
EAN: 2147483647
Year: 2003
Pages: 337

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