Dreamweaver CS4 Resources
|
Create record counters
Record counters give users a reference point
when they are navigating through a set of records. Typically, record
counters display the total number of records returned, and the current
records being viewed. For example, if a recordset returns 40 individual
records, and 8 records are displayed per page, the record counter
on the first page would indicate “Displaying records 1‑8 of 40.”
Before
you create a record counter for a page, you must create a recordset
for the page, an appropriate page layout to contain the dynamic
content, and then a recordset navigation bar.
Create simple record countersRecord counters let users know where they
are within a given set of records relative to the total number of
records returned. For this reason record counters are a useful behavior
that can significantly add to the usability of a web page.
Create
a simple record counter by using the Recordset Navigation Status
server object. This server object creates a text entry on the page
to display the current record status. You can customize the record
counter by using Dreamweaver page-design
tools.
- Place the insertion point where you want to insert
the record counter.
- Select Insert > Data Objects >
Display Record Count > Recordset Navigation Status,
select the recordset from the Recordset pop‑up menu, and click OK.
The Recordset Navigation Status server object inserts a
text record counter that appears similar to the following example:
When
viewed in the Live Data window or a browser, the counter appears
similar to the following example:
Build and add the record counter to the page In the Insert Recordset Navigation Status
dialog box, select the recordset to track, and click OK.
Create custom record countersYou use individual record count behaviors
to create custom record counters. Creating a custom record counter
lets you create a record counter beyond the simple, single row table
inserted by the Recordset Navigation Status server object. You can
arrange design elements in a number of creative ways, and apply an
appropriate server behavior to each element.
The Record Count
server behaviors are:
Before you create a
custom record counter for a page, you must first create a recordset
for the page, an appropriate page layout to contain the dynamic content,
and a recordset navigation bar.
This example creates
a record counter that appears similar to the example in “Simple
record counters.” In this example, the text in sans-serif font represents the
record count placeholders that will be inserted in the page. The
record counter in this example appears as follows:
Displaying
records StartRow through EndRow of RecordSet.RecordCount.
- In Design view, enter the counter’s text on the
page. The text can be anything you want, for example:
Displaying records thru of .
- Place the insertion point at the end of the text string.
- Open the Server Behaviors panel (Window >
Server Behaviors).
- Click the Plus (+) button in the upper-left corner, and
click Display Record Count. Within this submenu, select Display
Total Records. The Display Total Records behavior is inserted into
the page, and a placeholder is inserted where the insertion point
was. The text string now appears as follows:
Displaying records thru of {Recordset1.RecordCount}.
- Place the insertion point after the word records,
and select the Display Starting Record Count Number from the Server
Behaviors > Plus (+) button > Record Count
panel. The text string now appear as follows:
Displaying records {StartRow_Recordset1} thru of {Recordset1.RecordCount}.
- Now place the insertion point between the words thru and of,
and select the Display Starting Record Count Number from the Server
Behaviors > Plus (+) button > Record Count
panel. The text string now appear as follows:
Displaying records {StartRow_Recordset1} thru {EndRow_Recordset1} of{Recordset1.RecordCount}.
- Confirm that the counter functions correctly by viewing
the page in the Live Data window (View > Live Data);
the counter is similar to the following example:
Displaying records 1 thru 8 of 40.
If
the results page has a navigation link to move to the next set of
records, clicking the link updates the record counter to read as
follows:
Showing records 9 thru 16 of 40.
Links
don’t work in the Live Data window. To test them, you can use the
Preview in Browser feature. Ensure that you’ve selected the Preview
Using Live Data Server option in Preferences (Edit >
Preferences > Preview In Browser (Windows) or Dreamweaver >
Preferences > Preview In Browser (Macintosh)); then
select File > Preview In Browser.
|