awesome :-)
It works all fine.
Here my Code:
public function view($id = null) {
$this->News->contain('User');
$this->News->id = $id;
$this->set('News',$this->News->read());
$this->paginate = array(
'NewsComment' => array(
'conditions' => array(
'NewsComment.news_id' => $id,
'NewsComment.active' => 1,
),
'recursive' => -1,
'limit' => 1
)
);
$this->set('Comments',$this->paginate('NewsComment'));
}
didnt another way for 'recursive' => 1
Big Thanks :)
On 24 Dez., 18:34, Tilen Majerle <tilen.maje...@gmail.com> wrote:
> yes it is, you get news withoud NewsComment, so recursive -1 or use contain
> Behavior to limit for find method
>
> and than configure Paginator for NewsComment (use conditions for
> "NewsComment.news_id" = $yournewsid)
> and $comments = $this->paginate('NewsComment');
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2011/12/24 gloop <gl...@web.de>
>
>
>
>
>
>
>
> > Hello everbody.
>
> > I have 3 Tables:
> > - users [id; username; password]
> > - news [id; user_id; title; comment; created; modified;
> > news_comment_count]
> > - news_comment [id; news_id; username; title; comment; created;
> > modified; active]
>
> > news hasMany news_comment
> > news belongsTo user
> > news_comment belongsTo news counterCache true; counterScope =>
> > NewsComment 1
>
> > Now i want to view news with id 2 but i want to show max 20
> > news_comment.
>
> > Is there a way to use paginate?
>
> > Kind Regards
> > Steffen
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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
> > athttp://groups.google.com/group/cake-php
--
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
No comments:
Post a Comment