Hi guys,

is it possible to put a cfloop inside a cfloop?

Maybe there's a easier way to do this but basically, like on Google you can see the linked numbers 1,2,3,4,5,6,7,8, etc the amount of pages which have records on.  You can click on them instead of having to keep clicking on 'next' throughout the search.

I have the following code i made:

<tr>
<cfif isDefined("url.startresults") and url.startresults GT 9><cfset prevresults = url.startresults - 10>   
<td colspan="6" align="right"><a href="" class="MessageAlert">previous 10</a></td></cfif>
<cfif isDefined("url.startresults") and DisplayEnquiryList.RECORDCOUNT GT (url.startresults + 9)><cfset url.startresults = url.startresults + 10>   
<td colspan="6" align="right"><a href="" class="MessageAlert">next 10</a></td></cfif>
<cfloop index="i" from="1" to="#DisplayEnquiryList.RECORDCOUNT#" step="10">
<cfoutput><a href="" class="MessageAlert">#i#</a></cfoutput>
</cfloop>
</tr>

It basically shows the records in groups of 10, and displays a 'next' link and 'previous' if applicable depending on whether there are that many records to show.

In this case there are about 54 records so my CFLOOP displays links in steps of 10:

1 11 21 31 41 51

But i would instead prefer them to be page numbers like 1 2 3 4 5.

Can i make a CFLOOP inside that CFLOOP to count the page numbers or is there an easier way?

Thanks,

Stuart
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to