//sets custom parameters:post.category = 1:
$conditions = array('Post.category' => 1);
//gets the category from search:
$category = $this->params['pass']['category'];

$paginationParameters = array();
$paginationParameters['controller'] = 'posts';
$paginationParameters['action'] = $this->action;
$paginationParameters['category'] = $category;

$this->paginate['Post'] = array(
'limit' => 1,
'order' => array ('Post.id' => 'desc'),
'url' => array ('url' => $paginationParameters)
);

$records = $this->paginate('Post', $conditions);

Here we create a paginate function with custom parameters and
paginationParameters!
This is working fine in my app...

Check out the example from Mariano Iglesias for more details:
http://groups.google.com/group/cake-php/browse_thread/thread/f990a45967935665/d45ee41f79f69031?lnk=gst&q=pagination+categories&rnum=1#d45ee41f79f69031

A big thanks to Nate, Mariano Iglesias, AD7six, Chris Hartjes and
PhpNut for all the great answers here in google-groups!
You have helped me a lot in my Cake baking process, and you make the
Cake grow even bigger =) Thanks!

On May 26, 4:21 pm, dardosordi <[EMAIL PROTECTED]> wrote:
> is there any way i can use $this->paginate() with a custom query?
>
> I'm doing a double join and filtering the results and need to paginate
> my results. Hope somebody could help me with this. Ask me if you need
> more details about my models, etc.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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