PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
$criteria = new CDbCriteria;
$sql = "SELECT * FROM {{account}}"; $model= Yii::app()->db->createCommand($sql)->queryAll(); $count = count($model); $pages = new CPagination(count($model)); $pages->pageSize = 1; $pages->applylimit($criteria); $model=Yii::app()->db->createCommand($sql." LIMIT :offset,:limit"); $model->bindValue(':offset', $pages->currentPage*$pages->pageSize); $model->bindValue(':limit', $pages->pageSize); $model=$model->queryAll(); $this->render('shouquan',array('pages'=>$pages,'list'=>$model,'count'=>$count)); ####shouquan.php <?php foreach($list as $value): <?php echo $value['f']; ###字段处理 <?php endforeach; <?php $this->widget('CLinkPager',array( 'header'=>'', 'firstPageLabel' => '首页', 'lastPageLabel' => '末页', 'prevPageLabel' => '上一页', 'nextPageLabel' => '下一页', 'pages' => $pages, 'maxButtonCount'=>13 ) );
转载请注明:谷谷点程序 » yii数据分页处理方法