YII分页方法(控制器与视图分页)
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-07-25 08:53:01
original
979 Les gens l'ont consulté
-
- public function actionTest()
- {
- $criteria=new CDbCriteria;
- $criteria->order='id DESC';
- $count=User::model()->count($criteria);
- $pager=new CPagination($count);
- $pager->pageSize=10;
- $pager->applyLimit($criteria);
- $userList=User::model()->findAll($criteria);
- $this->render('test',array('list'=>$userList,'pages'=>$pager));
- } // bbs.it-home.org
复制代码
2,视图部分代码:
-
- foreach($list as $o)
- {
- echo $o->username.'
';
- echo $o->id.'
';
- }
- $this->widget('CLinkPager',array(
- 'header'=>'',
- 'firstPageLabel' => '首页',
- 'lastPageLabel' => '末页',
- 'prevPageLabel' => '上一页',
- 'nextPageLabel' => '下一页',
- 'pages' => $pages,
- 'maxButtonCount'=>13
- )
- );
复制代码
|
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Derniers articles par auteur
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11