You could do something simple like this:
<cfif len(pageList) gt 15>
output first 7 page links
...
output last 2 page links
</cfif>
Chris Peterson
-----Original Message-----
From: Steve LaBadie [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 12, 2007 9:04 AM
To: CF-Talk
Subject: Page to Page Navigation
I have page navigation that shows the number of pages of a search
results; 25 per page (Example: Page 1 2 3 4 5 6 7 Show All). Is there a
way to condense the numbers like the way Google does it so I don't have
50 numbers going across the page?
Page 1 2 3 4 5 6 7 8 9 10 Show All
Previous 10 11 12 13 14 15 16 17 18 19 20
And so on
My code is:
<cfset ThisPage = 1>
<!--- Loop thru row numbers, in increments of RowsPerPage --->
<cfloop from="1" to="#TotalRows#" step="#RowsPerPage#" index="PageRow">
<!--- Detect whether this "Page" currently being viewed --->
<cfset IsCurrentPage = (PageRow GTE URL.StartRow) AND (PageRow LTE
EndRow)>
<!--- If this "Page" is current page, show without link --->
<cfif IsCurrentPage>
<cfoutput><strong>#ThisPage#</strong></cfoutput>
<!--- Otherwise, show with link so user can go to page --->
<cfelse>
<cfoutput>
<a href="#CGI.SCRIPT_NAME#?StartRow=#PageRow#">#ThisPage#</a>
</cfoutput>
</cfif>
<!--- Increment ThisPage variable --->
<cfset ThisPage = ThisPage + 1>
</cfloop>
Steve LaBadie, Web Manager
East Stroudsburg University
200 Prospect St.
East Stroudsburg, Pa 18301
570-422-3999
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.esu.edu <http://www3.esu.edu>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2.
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275070
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4