了解知识
form表单
Views中:
 
Models中:
public function getCategoryList()
{
$returnArr = $this->findAll();
return CHtml::listData($returnArr, 'cate_id', 'cate_name');
}
 
查询列表
Models中:
public function getCateName($id)
{
$currCate = $this->findByAttributes(array('cate_id'=>$id));
return $currCate->cate_name;
}
Views中: (admin.php)
//'cate_id',
array('name'=>'cate_id', 'value'=>'Category::model()->getCateName($data->cate_id)', 'filter'=>Category::model()->getCategoryList()),
标签: Yii框架
扩展知识