的Zend talk.I行模型方法已经称为视图“文章”里面一个partialLoop,在DB显示所有评论该职位:Zend公司:内用partialLoop
[..]
echo $this->partialLoop('_comments.phtml',$this->comments);
这是_comments.phtml:
<li><?= $this->text." ".$this->datetime;?></li>
由于意见DB表的结构是:
id(PK) | text | datetime | authorId
我想检索“AUTH作者姓名或_comments.phtml中的“DB表”,带有CommentRow的方法。
这是CommentRow模型:
class CommentRow extends Zend_Db_Table_Row_Abstract
{
function getAuthor()
{
$author=new Author();
$q=$author->select('name');
$q->where('id',$this->authorid);
$result=$comment->fetchRow($q);
return $result;
}
}
我怎样才能通过的注释(这是类型CommentRow的对象),传递给局部回路中的阵列,调用getAuthor迭代( )方法来显示评论的作者姓名?
感谢 卢卡
我不认为我明白= S我想要在部分循环内使用getAuthor()方法 – luca 2011-05-16 17:55:35