Hi All,
I've written a customtag to do paging;
Basically, I can pass a recordcount in, and it'll output
<< 1, 2, 3, 4, 5, 6, 7, >>
- This works fine;
However, I really need it to do this:
<< 1, 2, 3, ... 8, 9 ,10 >>
as the recordsets I'm now dealing with are getting quite big;
Any one know how I can do this?
Or has anyone come across a code example I can look at?
My code is:
<!---Paging--->
<cfif thisTag.executionMode is "start">
<cfsilent>
<cfscript>
page=attributes.page;
recordsperpage=attributes.recordsperpage;
totalpages=Ceiling(attributes.recordcount/recordsperpage);
</cfscript>
<cfif page GT totalpages><cfset page=totalpages><cfelseif page LT
1><cfset page=1></cfif>
<cfscript>
startrow=(page-1)*recordsperpage+1;
endrow=startrow+recordsperpage-1;
caller.startrow=startrow;
caller.endrow=endrow;
</cfscript>
</cfsilent>
<cfif totalpages GT 1>
<cfoutput><div class="paging"></cfoutput>
<cfif page GT 1>
<cfoutput><a href="#REReplace(attributes.urlroot & "?" &
CGI.QUERY_STRING,'&page=[0-9]+','','ALL')#&page=#page-1#"
title="Go to
previous page" class="previouspage">«</a></cfoutput>
<cfelse>
<cfoutput><span class="previouspage inactive">«</span></
cfoutput>
</cfif>
<cfloop index="i" from="1" to="#totalpages#">
<cfif i EQ page>
<cfoutput>#i#</cfoutput>
<cfelse>
<cfoutput><a href="#REReplace(attributes.urlroot & "?" &
CGI.QUERY_STRING,'&page=[0-9]+','','ALL')#&page=#i#" title="Go to
page
#i#" class="number">#i#</a></cfoutput>
</cfif>
</cfloop>
<cfif page LT totalpages>
<cfoutput><a href="#REReplace(attributes.urlroot & "?" &
CGI.QUERY_STRING,'&page=[0-9]+','','ALL')#&page=#page+1#"
title="Go to
next page" class="nextpage">»</a></cfoutput>
<cfelse>
<cfoutput><span class="nextpage inactive">»</span></cfoutput>
</cfif>
<cfoutput></div></cfoutput>
</cfif>
</cfif>
Thanks!
T
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300384
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4