<div class="page-link">
<?php $this->widget('CLinkPager',array(
'header' => '',
'firstPageLabel' => '首页',
'lastPageLabel' => '尾页',
'prevPageLabel' => '<',
'nextPageLabel' => '>',
'pages' => $pages,
'maxButtonCount'=>5,
'htmlOptions' => array('class' => 'page-link'), //分页要使用的css样式
));?>
</div>
<?php
/**
* 分页组建ClinkPager扩展
* @description page-tab-tog为分页的样式class
* @author <[<xm 杭州>]>
* @time 2016-01-29
* @example
* <div class="page-tab-tog">
* <?php $this->widget('MLinkPager',array(
* 'header' => '',
* 'firstPageLabel' => '首页',
* 'lastPageLabel' => '尾页',
* 'prevPageLabel' => '<',
* 'nextPageLabel' => '>',
* 'pages' => $pages,
* 'maxButtonCount'=>5,
* 'htmlOptions' => array('class' => 'page-tab-tog'),
* ));?>
* </div>
*/
class MLinkPager extends CLinkPager
{
//设置为true的时候,显示共X页,$this->forceTotalPage值优先该值
public $mCountPage = false;
//是否强制显示共x页,设置为true时,$this->mCountPage和$this->getPageRange()无效
public $forceTotalPage = false;
public function init()
{
}
public function run()
{
$this->registerClientScript();
$buttons=$this->createPageButtons();
list($beginPage,$endPage)=$this->getPageRange();
if ($this->forceTotalPage)
{
$buttons[] = CHtml::tag('li', array('class'=>'totle'),'共'.$this->getPageCount().'页');
}
else
{
if ($this->mCountPage && $endPage > 0)
{
$buttons[] = CHtml::tag('li', array('class'=>'totle'),'共'.$this->getPageCount().'页');
}
}
if(empty($buttons))
return;
echo $this->header;
echo CHtml::tag('div',$this->htmlOptions,implode("\n",$buttons));
echo $this->footer;
}
}
<div class="page-tab-tog">
<?php $this->widget('MLinkPager',array(
'header' => '',
'firstPageLabel' => '首页',
'lastPageLabel' => '尾页',
'prevPageLabel' => '<',
'nextPageLabel' => '>',
'pages' => $pages,
'maxButtonCount'=>5,
'mCountPage' => true, //!!!注意看这里,加一行代码就ok了
'htmlOptions' => array('class' => 'page-tab-tog'),
));?>
</div>
$criteria = new CDbCriteria(); //new cdbcriteria数据库<br>$criteria->id = 'id ASC'; //排序规则 $count = Exchange::model()->count($criteria); $pager = new CPagination($count); $pager->pageSize=30; $pager->applyLimit($criteria); $categoryInfo = Category::model()->findAll($criteria); //根据条件查询
$criteria = new CDbCriteria();
$criteria->order = 'id ASC';
$criteria->addCondition('status=1'); //根据条件查询
$criteria->addCondition('exchange_status=0');
$count = Exchange::model()->count($criteria);
$pager = new CPagination($count);
$pager->pageSize=30;
$pager->applyLimit($criteria);
$exchangeInfo = Exchange::model()->findAll($criteria);
array("pages" => $pager)
$this->widget('CLinkPager',array(
'header'=>'',
'firstPageLabel' => '首页',
'lastPageLabel' => '末页',
'prevPageLabel' => '上一页',
'nextPageLabel' => '下一页',
'pages' => $pages,
'maxButtonCount'=>8,
)
);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有