|
先上效果图,突然发现和B站上一样
IndexController.class.php代码如下
public function index(){
$m=M('Info');
$count = $m->where($where)->count();
$pageCount = 10;//每页显示数量
$page = new \Think\Page($count , $pageCount);
$page->parameter = $row; //此处的row是数组,为了传递查询条件
$page->setConfig('header','条留言');
$page->setConfig('first','首页');
$page->setConfig('prev','上一页');
$page->setConfig('next','下一页');
$page->setConfig('last','尾页');
$page->setConfig('theme','%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END%第 '.I('p',1).' 页/共 %TOTAL_PAGE% 页 ( '.$pageCount.' 条/页 共 %TOTAL_ROW% 条信息)');
$show = $page->show();
$list = $m->where($where)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select();
$this->assign('infoList',$list);
$this->assign('show',$show);
$this->display();
}
index.html代码如下
类别 | 信息标题 | 物品类型 | 遗失/拾物时间 | 遗失/拾物地点[/td]
发布时间 | {$vo.info_type} | {$vo.info_title} | {$vo.thing_type} | {$vo.info_time} | {$vo.info_place} | {$vo.create_time} |
{$show}
css代码如下
/* start 分页样式 */
.page{
overflow:hidden;
margin:50px 0 50px 100px;;
}
.page ul a,.page ul span{
float:left;
display:inline-block;
padding: 0 17px;
height:40px;
width:auto;
border:1px solid #DDDDDD;
border-radius: 4px;
background:#fff;
text-align:center;
line-height:40px;
margin-right:10px;
font-family: "microsoft yahei" simhei sans-serif;
color:#7d7d7d;
}
.page ul a:hover{
background:#337AB7;
color:#fff;
text-decoration:none;
}
.page ul span.current{
background: #337AB7;
color:#fff;
}
.page ul a:first,.page ul a:last{
float:left;
display:inline-block;
width:40px;
height:40px;
border-radius:50%;
background:rgb(215, 215, 217);
text-align:center;
line-height:40px;
margin-right:10px;
font-family: "microsoft yahei" simhei sans-serif;
}
#pageTips {
float:right;
}
/* end 分页样式 */
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
您可能感兴趣的文章:thinkPHP中分页用法实例分析ThinkPHP3.2.3实现分页的方法详解thinkphp3.2.3 分页代码分享Thinkphp3.2.3分页使用实例解析thinkphp分页实现效果ThinkPHP实现分页功能thinkPHP分页功能实例详解thinkPHP多表查询及分页功能实现方法示例thinkphp分页集成实例
|
|