Friday, November 25, 2011

How to paginate in HasAndBelongsToMany?(a liitle bit confused )

I do have a articles model and tags model.

articles HABTM tags

i use $this->set('articles', $this->Article->paginate()); and i can
use paginator in index.ctp of Articles.

I try to search articles by Tags, but the problem is it doesn't fit
with the paginator.

here's the code for showing of articles
$articles = $this->paginate('Article', $condition);

and here's when i try to search by tag name
$condition = array('Tag.slug' => $this->passedArgs['tag']);
$articles = $this->paginate('Article.Tag', $condition);

But the come with different structure.

How can i solve this one?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate