//设置分页查询
$Data = M('think.Huodong_fenlei'); // 实例化Data数据对象
import('ORG.Util.Page');// 导入分页类
$count = $Data->where($map)->count();// 查询满足要求的总记录数
$Page = new Page($count,1);// 实例化分页类 传入总记录数并且每页显示5条记录
$nowPage = isset($_GET['p'])?$_GET['p']:1;
$list = $Data->where($map)->order('addtime desc')->page($nowPage.','.$Page->listRows)->select();
$show = $Page->show();// 分页显示输出
$this->assign('page',$show);// 赋值分页输出
$this->assign('list',$list);// 赋值数据集
$this->display();
CSS部分.result.page {
height: 40px;
width: auto;
text-align: center;
line-height: 40px;
padding-right: 30px;
padding-left: 30px;
margin: 15px auto 30px;
}
.result.page a {
height: 25px;
width: auto;
display: inline-block;
color: #333;
border: 1px solid #CCC;
text-decoration: none;
line-height: 25px;
padding-left: 5px;
padding-right: 5px;
background-color: #F9F9F9;
}
.result.page .current {
height: 25px;
width: auto;
padding-left: 8px;
padding-right: 8px;
line-height: 25px;
display: inline-block;
background-color: #09F;
color: #FFF;
}
.result.page a:hover {
background-color: #09F;
color:#FFF;
border: 1px solid #09F;
}
page.zip ( 8.4 KB 下载:57 次 )