1. 程式人生 > >yii分頁操作

yii分頁操作

cdb ges sel () css color ray cnblogs total

$model=Article::model();

$a = new CDbCriteria();
$a->order = ‘head DESC,time DESC‘; //從左到右按規則排序

$total = $model->count($a);
$pager = new CPagination($total);
$pager->pageSize = 15;
$pager->applyLimit($a);
$model = $model->findAll($a);

$this->widget(‘CLinkPager‘,array(
‘header‘=>‘‘,
‘firstPageLabel‘ => ‘首頁‘,
‘lastPageLabel‘ => ‘末頁‘,
‘prevPageLabel‘ => ‘上一頁‘,
‘nextPageLabel‘ => ‘下一頁‘,
‘pages‘ => $pages
, ‘maxButtonCount‘=>8, //加載第三方page css ‘cssFile‘=>false, ‘htmlOptions‘ =>array("class"=>"pagination"), ‘selectedPageCssClass‘=>"active" ) );

yii分頁操作