yii的分页显示与设置

来源:互联网 发布:常见数据库有哪些 编辑:程序博客网 时间:2024/05/18 03:27
controllers里设置
分页开始<!-----start------>
$criteria=new CDbCriteria();
$criteria->order=' manyou_id desc';
$count=$Manyou->count($criteria);
$pager=new CPagination("$count");
$pager->pageSize=10;
$pager->applyLimit($criteria);
分页结束<!-----end-------->

在views页面里显示
显示分页<!-----start------>
<div class="change_page">              
                        <?php
                            /**/
                            $this->widget('CLinkPager',array(
                                'header'=>'',
                                'firstPageLabel'=>'<span style="font-weight:normal;color:#000;">首页</span>',
                                'lastPageLabel'=>'<span style="font-weight:normal;color:#000;">末页</span>',
                                'prevPageLabel'=>'<span style="width:23px;height:18px; margin-top:-1px; border:1px solid #008c78;" class="left_page no_padding"></span>',
                                'nextPageLabel'=>'<span style="width:23px;height:18px; margin-top:-1px; border:1px solid #008c78;" class="right_page"></span>',
                                'pages'=>$pages,
                                'maxButtonCount'=>13,
                                )
                            );
                        ?>
</div>
分页结束<!------end------->