forecho

把生命浪费在美好的事物上

Yii CListView使用方法

2013年05月22日

widget(‘zii.widgets.CListView’, array(          ’dataProvider’=>$model->search(20),          ’itemView’=>’_view’,            ’emptyText’=>’暂时没有数据’,         //’template’=>’{items}{pager}’,         ’pager’=>array(‘class’=>’CLinksPager’),         ’htmlOptions’=>array(‘class’=>’list-view pro_list bd’),         ’itemsTagName’=>’ul’,         ’itemsOptions’=>array(‘class’=>’list c_f’),         ’summaryText’=>’第 {start}-{end} 条, 共{count} 条   第{page}页/共{pages}页’,         ’pagerTemplate’=>’onlyPager’,         ’buttonCssClass’=>’bg_x btn_page’,         ’batchItemOptions’=>array(‘class’=>”f_l batchItem”),         ’batchItem’=>array(              //移动到分类              ’排序:’,              //添加到分类              CHtml::link(‘默认排序’,array(‘list’,’id’ => $model->catgory_id,’att’ =>$g_att,’sort’=>”),array(‘class’=>empty($model->list_order)?”default price”:”default”)),             CHtml::link(($model->list_order==4)?’价格’:’价格‘,array(‘list’,’id’ => $model->catgory_id,’att’ =>$g_att,’sort’=>($model->list_order==4)?6:4),array(‘class’=>($model->list_order==4||$model->list_order==6)?”bg_x price”:”bg_x”)),              CHtml::link(($model->list_order==5)?’销量’:’销量‘,array(‘list’,’id’ => $model->catgory_id,’att’ =>$g_att,’sort’=>($model->list_order==2)?5:2),array(‘class’=>($model->list_order==2||$model->list_order==5)?”bg_x price”:”bg_x”)),             CHtml::link(($model->list_order==7)?’上架时间’:’上架时间‘,array(‘list’,’id’ => $model->catgory_id,’att’ =>$g_att,’sort’=>($model->list_order==1)?7:1),array(‘class’=>($model->list_order==1||$model->list_order==7)?”bg_x price”:”bg_x”)),          ),          ));  ?>

简单说明: template是整个CListView的模板;