另一个相当基本的问题 我原谅,但我感到,我同我一样,坐在圈子里,摆脱思想, ha。
我试图建立一个有想象力的评议系统(通过Ajax),这必须能够显示用户的名称、ava等等,从而撰写了特别的评论。 足够简单、正确吗?
不管怎样,所有事情都是很出色的,但迄今为止,我只是找回相应用户信息的途径,而我也找不到任何东西在笔试中有所帮助。
这里,我迄今为止的《座谈法》:
$this->paginate[ Comment ] = array(
conditions =>array( Entry.id =>$id),
contain => array( Entry , User =>array( avatar , username ) ),
limit => 10
);
$comments = $this->paginate( Comment );
$this->set(compact( comments ));
因此,我已经用了软件来获取用户模型的数据。
echo $comment[ User ][ username ];
echo $comment[ User ][ avatar ];
但是,这当然显示用户的信息相当于......美元。
However, I need to get a users info through the foreignkey user_id of the current comment. And at the moment I m at a loss how to do that... Any help would be greatly appreciated. Thanks in advance!