Quick clarification:

> pagesize -> the number of items on a page
>
> <cfloop from="1" to="#pagecount#" index="curpage">
>   <a href=""> > </cfloop>

Of course, if you do it this way then to get the records you actually
need you'll have to do a quick multiplication and add one (so you get
e.g. the 11th result first, not the 10th).  So a quick hack into your
code would give:

<cfset startresults = (url.page * pagesize) + 1>

Tim.

-------------------------------------------------------
<CF_CodingContest mode="judging" newentries="false">
Maze Solver - http://tech.badpen.com/cfcontest/
-------------------------------------------------------
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
-------------------------------------------------------
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
-------------------------------------------------------

> -----Original Message-----
> From: Tim Blair [mailto:[EMAIL PROTECTED]
> Sent: 11 March 2004 11:49
> To: CF-Talk
> Subject: RE: Loops in Loops (let's go loopy)
>
> > is there an easier way?
>
> I usually do that by having a couple of variables:
>
> page -> the current page you're on (from URL) pagesize -> the
> number of items on a page (hardcode/from URL) recordcount ->
> the total number of results (from your query)
>
> You can then work out things like the total number of pages
> (the ceiling function is to round the number of pages up to
> the closest integer) :
>
> <cfset pagecount = ceiling(recordcount / pagesize)>
>
> And then loop from 1 to pagecount and print out a number and link each
> time:
>
> <cfloop from="1" to="#pagecount#" index="curpage">
>   <a href=""> > </cfloop>
>
> HTH,
>
> Tim.
>
>
> -------------------------------------------------------
> <CF_CodingContest mode="judging" newentries="false"> Maze
> Solver - http://tech.badpen.com/cfcontest/
> -------------------------------------------------------
> RAWNET LTD - Internet, New Media and ebusiness Gurus.
> WE'VE MOVED - for our new address, please visit our website
> at http://www.rawnet.com/ or call us any time on 0800 294 24 24.
> -------------------------------------------------------
> This message may contain information which is legally
> privileged and/or confidential.  If you are not the intended
> recipient, you are hereby notified that any unauthorised
> disclosure, copying, distribution or use of this information
> is strictly prohibited. Such notification notwithstanding,
> any comments, opinions, information or conclusions expressed
> in this message are those of the originator, not of rawnet
> limited, unless otherwise explicitly and independently
> indicated by an authorised representative of rawnet limited.
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to