Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Advanced recordset navigation - Help Needed!!!

0 views
Skip to first unread message

ShaGGy0o0

unread,
Sep 22, 2004, 3:27:24 AM9/22/04
to
I am trying to figure out how to incorporate recordset paging for a custom tag
that will show only the amount of pages that you want.

Like :

1 2 3 4 5 6 7 8 9 10

and when you progress to, say page 7, the numbers look like this

3 4 5 6 7 8 9 10 11 12

but instead of hardcoding it to 10 records, I want to be able to expand it to
15 or 20 or 30 - depending on the client's needs.


I already have a fully functioning recordset navigation module.

Lets assume that there is a "back to first" and a "Previous" button, the
numbers of pages of the recordset, and then the "Next" and "go to last"
buttons.

My question is not how to do recordset paging, but how to show only a limited
amount of page numbers, depending on the viewer's present page focus. I have it
set up to show x no. of query rows per page already. The best example of this
is Googles page navigation when navigating through the results of a search.

Thank you


Richard Wilde

unread,
Sep 22, 2004, 6:59:11 AM9/22/04
to
Perhaps this wil get you started

Create a page called test.cfm and paste all of this code into it. You may
need to format back as wrapping will occur. If you like I could email it to
you....

<!---ShaGGy0o0 change this var to the number of pages you wish to show--->
<cfset noPagesToshow = 10>

<cfparam default="1" name="currentPageNo">
<cfif isDefined("pageNo")><cfset currentPageNo = URL.pageNo></cfif>
<cfif currentPageNo lt 1><cfset currentPageNo = 1></cfif>


<cfif currentPageNo - int(noPagesToshow / 2) lt 0>
<cfset startPage = 1>
<cfset lastPage = noPagesToshow>
<cfelse>
<cfset startPage = currentPageNo - int(noPagesToshow / 2)>
<cfset lastPage = currentPageNo + int(noPagesToshow / 2) >
</cfif>


<cfloop from="#startPage#" to="#lastPage#" index="i">
<cfoutput><cfif currentPageNo eq i><strong>#i#</strong><cfelse><a
href="test.cfm?pageNo=#i#">#i#</a></cfif> </cfoutput>
</cfloop>

<br/>
<cfoutput><a href="test.cfm?pageNo=#currentPageNo-1#">Prev</a> | <a
href="test.cfm?pageNo=#currentPageNo+1#">Next</a></cfoutput>

Rippo


"ShaGGy0o0" <webfor...@macromedia.com> wrote in message
news:cir9gs$kee$1...@forums.macromedia.com...

ShaGGy0o0

unread,
Sep 22, 2004, 4:15:09 PM9/22/04
to
I appreciate it. The conditional statement on the current page is all I
needed.

Sometimes when you think about stuff so much, it's hard to truly realize that
the answer is simpler than you think.

Thanks again,
Chris

0 new messages