How to implement simple paging in Yii, implement paging in yii_PHP tutorial

WBOY
Release: 2016-07-12 08:53:05
Original
955 people have browsed it

How Yii implements simple paging, yii implements paging

The example in this article describes how Yii implements simple paging. Share it with everyone 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('Archives', array(
      'models' => $models,
      'pages' => $pages
    ));
}

Copy after login

view method

<ul>
<&#63;php foreach($models as $model): &#63;>
 <li><&#63;php echo $model->title;&#63;></li>
<&#63;php endforeach; &#63;>
</ul>
<&#63;php $this->widget('CLinkPager', array(
  'pages' => $pages,
    'header'=>'',
    'prevPageLabel'=>'上一页',
    'nextPageLabel'=>'下一页',
    'cssFile'=>'css/cc/css.css',
)) &#63;>

Copy after login

Readers who are interested in more Yii-related content can check out the special topics on this site: "Introduction to Yii Framework and Summary of Common Techniques", "Summary of Excellent PHP Development Framework", "Basic Tutorial for Getting Started with Smarty Templates", "php Date and Time" Usage Summary", "php object-oriented programming introductory tutorial", "php string (string) usage summary", "php mysql database operation introductory tutorial" and "php common database operation skills summary"

I hope this article will be helpful to everyone’s PHP program design based on the Yii framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1125260.htmlTechArticleYii's method to implement simple paging, yii to implement paging. This article describes the Yii method to implement simple paging. Share it with everyone for your reference, the details are as follows: yii paging method function act...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!