public $paginate = array(
'order' => array('Model.field' => 'ASC') // or 'DESC'
...
);
And you can override that in a controller action by changing
$this->paginate['order'] before calling $this->paginate().
Why the heck are the variable and method named the same, btw?
On Mon, Oct 11, 2010 at 5:27 PM, tricky999 <[email protected]> wrote:
> I want to display a set of paginated results, which are returned as an
> array based on a keyword search. The array from the search action
> puts the id of the entries in the order of their relevance.
> I am using this code in my action:
> $this->set('portfolioEntries', $this->paginate(null,
> array('PortfolioEntry.id'=>$result)));
> where $result contains the array, which is something like array
> (1,5,3,4,2) say. However, by default, it appears that pagination
> rearranges them in order that they were created so I end up with
> 1,2,3,4,5. Is there any way to override this?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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
>
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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