【发布时间】:2014-09-17 19:42:50
【问题描述】:
我有一个名为 Service 的简单模型,带有属性 (ServiceId, name, description, Image) , 我想使用 CListview 在视图中显示所有记录,但只显示名称和描述属性,而不是全部。
我可以显示模型,但我找不到隐藏 id 和 image 属性的解决方案。
谁能给出解决方案?
提前致谢。
这是我的代码:
控制器:
public function actionIndex()
{
$model = new Service();
$this->render('index',array(
'model'=>$model,
));
}
和我的观点:
<h1>Services</h1>
<?php
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$model->search(),
'itemView'=>'_view',
));
?>
【问题讨论】: