Yii implements simple paging, and yii implements Paging
This article describes how Yii implements simple paging. We will share this with you for your reference. The details are as follows:
Yii paging Method
Function actionPage () {$ criteria = new CDbCriteria (); $ count = Archives: model ()-> count ($ criteria); $ pages = new CPagination ($ count ); // results per page $ pages-> pageSize = 10; $ pages-> applyLimit ($ criteria); $ models = Archives: model ()-> findAll ($ criteria ); $ this-> render ('archivees', array ('models' => $ models, 'pages' => $ pages ));}
View Method
<Ul> <? Php foreach ($ models as $ model):?> <Li> <? Php echo $ model-> title;?> </Li> <? Php endforeach;?> </Ul> <? Php $ this-> widget ('clinkpager ', array ('page' => $ pages, 'header' => '', 'prevpagelabel' => 'previous page ', 'nextpagelabel '=> 'Next page', 'cssfile' => 'css/cc/css.css',)?>