Re: Paginate on the other model?
Ok i have found a way posted on the bin.. http://bin.cakephp.org/saved/21775 THe problem is when i know do a paginate on the Tag model itself this function will override the deault thus i wont get any result back :( On Apr 16, 2:32 pm, MonkeyGirl <[EMAIL PROTECTED]> wrote: > > but how can ipaginatethe articles and not the categories? > > Try linking to /articles/index/categories:category-slug instead of / > categories/view/category-slug > > This will go to the index function in your articles controller. Try > printing out $this->params['named'] - notice how it's an array with > things before colons as keys, and things after them as values. So you > can make something like this: > > function index() { > $categorySlug = $this->params['named']['category']; > $category = $this->Article->Category->findBySlug($categorySlug); > $scope = array('Article.category_id' => $colour['Colour']['id']); > $paginatedList = $this->paginate(NULL, $scope); > > } > > (This is mentioned in another > thread:http://groups.google.com/group/cake-php/browse_thread/thread/cf11aefa... > ) > > This is all well and good if categories have many articles... I'm not > so sure about HABTM. findAll doesn't seem to play so well with HABTM > relationships, and it looks like the paginator's using findAll... > > (This looks relevant:https://trac.cakephp.org/ticket/1209) > > So, yes, good question. Does anyone else know if the paginator can > work with HABTM conditions? > > Sorry I couldn't be of more help! > Zoe. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Paginate on the other model?
Hmmm i see so basically it's not possible and it will not be implemented looking at the trac.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Paginate on the other model?
> but how can i paginate the articles and not the categories? Try linking to /articles/index/categories:category-slug instead of / categories/view/category-slug This will go to the index function in your articles controller. Try printing out $this->params['named'] - notice how it's an array with things before colons as keys, and things after them as values. So you can make something like this: function index() { $categorySlug = $this->params['named']['category']; $category = $this->Article->Category->findBySlug($categorySlug); $scope = array('Article.category_id' => $colour['Colour']['id']); $paginatedList = $this->paginate(NULL, $scope); } (This is mentioned in another thread: http://groups.google.com/group/cake-php/browse_thread/thread/cf11aefa6535855e ) This is all well and good if categories have many articles... I'm not so sure about HABTM. findAll doesn't seem to play so well with HABTM relationships, and it looks like the paginator's using findAll... (This looks relevant: https://trac.cakephp.org/ticket/1209 ) So, yes, good question. Does anyone else know if the paginator can work with HABTM conditions? Sorry I couldn't be of more help! Zoe. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---