Also available for ASP/VB
Users of the Repeat Region have a convenient way to navigate records using the Recordset Navigation Bar, built into Dreamweaver as an application object. However, there is no way to do the same thing with a Detail page (part of the Master Detail Page Set application object). Here is why:
A Detail page contains a recordset that has one record in it and one record only: a record that is retrieved via a URL variable. When your end user views a list of records on a Master page, he can click a link that passes the URL variable to the detail page. The detail page retrieves one record only, based on the primary key or other unique field of the table. There is no way to predict what the "next" or "previous" record will be, based on the key value, because the records may not be sequential. For example, even when a key is an autonumber field that is sequential, if a record is deleted the previous or next record number can no longer be predicted.
It is true that you can create a navigable detail page by using a Repeat Region and a repeat count of 1, but the Repeat Region behavior unfortunately retrieves an entire recordset of all records, even if you only want to show 1 record. This is not desirable.
The Detail Page Navigation Server Behavior Suite
The server behavior suite consists of 8 server behaviors:
- Detail Page Navigation: Adds optimized code to the page to retrieve the record numbers for the first, previous, next, and last record numbers.
- First Record: Creates a link to move to the first record
- Previous Record: Creates a link to move to the previous record
- Next Record: Creates a link to move to the next record
- Last Record: Creates a link to move to the last record
- Hide If First Record: Hides a region if the current record is the first record.
- Hide If Last Record: Hides a region if the current record is the last record.
- Detail Page Navigation Bar : Combination of all server behaviors in one fell swoop. Creates a first, previous, next, and last link navigation bar including hiding the previous and first links if the current record is the first record, and hiding the next and last links if the current record is the last record
Detail Page Navigation
This server behavior retrieves the values of the first, previous, next, and last record ids from your database table. The page you are applying the behavior to must be a Detail page that retrieves one record from your database for display. For information on how to create a detail page, see the Dreamweaver documentation under Help > Using Dreamweaver Developing Applications Rapidly > Building ASP and JSP Applications Rapidly > Building Master/Detail Pages.
To apply the server behavior, follow these steps:
- Choose the connection used for the database
- Choose the table name where the data is retrieved from
- Choose the recordset used by the detail page
- Choose the key column used to find the current record (usually your primary key)
- Type in the URL parameter name (or form field parameter name) that allows your detail page recordset to retrieve the appropriate record
- Click the radio button next to the type of data for the key column (usually an integer or other number column)
- (OPTIONAL): Most detail pages will not have additional filters, however if you have an additional filter you want to apply to the details page recordset (such as "WHERE ShowOnWeb = 1"), type the filter into the filter box* in the form of "name=value". Here are some examples:
ProductID < 25
ShowOnWeb = 1
Category = '$category'
ProductName LIKE '%$product%'
*Note: If you want to use a Session, Form, Get, or other type of global variable, you must set it up first as as page parameter, like:
$myPageParam = "";
$myPageParam = $_SESSION["myVar"];
After applying the server behavior, you can now create First, Previous, Next, and Last links.
Previous Record / Next Record
These four server behaviors create links to the first, previous, next, or last detail page. You can use them on text that is already on the page, or create new text to add a link to.
Hide If First Record / Last Record
These are typically applied to the First, Previous, Next, and/or Last links to hide them if no previous or next records exist.
Detail Page Navigation Bar
This server behavior is applied just like the Detail Page Navigation behavior, except it will also generate a navigation bar at the current cursor position.
This Server Behavior Suite works in PHP/MySQL in Dreamweaver 6 and higher.
For more information, contact Tom Muck at http://www.tom-muck.com/contact.cfm