Adding Links and URL Parameters to a Master Page


Once you've created the master page recordset and inserted a dynamic table, you add links and URL parameters to the master page. First you add the link, and then you add a URL parameter to the end of the link. The URL parameter uses a field in the database table that uniquely identifies a recordfor example, a primary key fieldto link the text on the master page to a specific record that displays on the detail page when the link is clicked.

URL parameters use the HTTP GET method to send data to the server by adding the data to the end of a URL. When the Web server receives a page request with URL parameters added to the request, it passes the page to the application server, which makes a connection to the database, retrieves the current value of those parameters, and adds them to the requested page before the page is sent to the browser. For more information on URL parameters, see "Using URL and Form Parameters," in Chapter 8.

In the following task, you'll add a link and a URL parameter to the dynamic table you created in the preceding task.

To add links and URL parameters to a master page:

1.

Open master_cafe.cfm or the dynamic page you used in the previous section.

2.

In Design view, select the dynamic text placeholder in the first cell of the second row (Figure 10.11).

Figure 10.11. Select the dynamic text placeholder in the first cell to add a link to the detail page.


3.

In the Property inspector, enter a name for the detail page in the Link field. We named our page detail_cafe.cfm (Figure 10.12).

Figure 10.12. Enter a name for the detail page in the Link field of the Property inspector.


You've now added a link to the detail page. Next you'll add a URL parameter to that link.

4.

Add a URL parameter to the end of the link name in the Property inspector or in Code view, as shown in Figure 10.13. Give the URL parameter a name (recordNum), and add the recordset name (cafe) and the field name for the unique identifier of the record (CODE). The format of the URL parameter varies depending on the application server you're using, so choose one of the following formats:

Figure 10.13. In Code view, you can see that the URL parameter (starting with ?) is added to the end of the link you added to the dynamic text placeholder.


  • ColdFusion:

    ?recordNum=#cafe.CODE#

  • ASP:

    ?recordNum=<%=cafe("CODE ")%>

  • PHP:

     ?recordNum=<?php echo  $row_cafe['CODE]; ?> 

5.

Save the page.

In the next section, you'll create the detail page to complete the master/detail page set.




Macromedia Dreamweaver 8 Advanced for Windows and Macintosh. Visual Quickpro Guide
Macromedia Dreamweaver 8 Advanced for Windows and Macintosh: Visual QuickPro Guide
ISBN: 0321384024
EAN: 2147483647
Year: 2004
Pages: 129
Authors: Lucinda Dykes

Similar book on Amazon

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