I figured it out, thanks for the idea David.

Basically what I do is count all the posts that are newer then the one
I am looking for (including the current one), this gives me the number
of the post. I then divide that by the number of items per page and
do:
$this->paginate['Model']['page'] = $page;

Works wonderfully!

On Nov 13, 9:00 am, Walther <[EMAIL PROTECTED]> wrote:
> The idea is for a forum, so the page of a particular post will not
> change (New posts are added to the end of the set).
>
> Can I force the paginate method in the controller to load a specific
> page? If so, how?
>
> On Nov 13, 4:48 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>
> > Shouldn't be too hard. Get the ids of all records with the same  
> > conditions as used by paginate, find out at which position your id is,  
> > divide by number of records per page. There's probably a way to do it  
> > all in SQL, without parsing everything in PHP.
>
> > The problem is, depending on your dataset and how often it changes,  
> > that that position will change between pageloads, or at least that the  
> > URL won't work for very long (hence not bookmarkable etc).
>
> > On 13 Nov 2008, at 00:25, Walther wrote:
>
> > > I don't know if this has been answered yet (And so far my searching
> > > has been fruitless, so either it hasn't or I'm using the wrong terms).
>
> > > Anyways, I'm using 1.2RC3 and managed to get the paginate feature
> > > working wonderfully (was very easy as well).
>
> > > Now I wish to add the ability for a user to jump to a page that
> > > contains a specific record, the id (or some other unique identifier)
> > > for the record is known, how would I go about finding which page the
> > > particular record appears on? I assume that I'd need to write my own
> > > paginate methods?
>
> > > Regards
> > > Walther.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to