先上效果图,突然发现和b站上一样
indexcontroller.class.php代码如下
public function index(){
$m=m('info');
$count = $m->where($where)->count();
$pagecount = 10;//每页显示数量
$page = new thinkpage($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%<div id="pagetips">第 '.i('p',1).' 页/共 %total_page% 页 ( '.$pagecount.' 条/页 共 %total_row% 条信息)</div>');
$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代码如下
<table class="table table-hover table-striped" id="table">
<tr class="danger">
<th>类别</th>
<th>信息标题</th>
<th>物品类型</th>
<th>遗失/拾物时间</th>
<th>遗失/拾物地点</th>
<th >发布时间</th>
</tr>
<foreach name="infolist" item='vo'>
<tr >
<td>{$vo.info_type}</td>
<td>{$vo.info_title}</td>
<td>{$vo.thing_type}</td>
<td>{$vo.info_time}</td>
<td>{$vo.info_place}</td>
<td>{$vo.create_time}</td>
</tr>
</foreach>
</table>
<div class="page">
<ul>
{$show}
</ul>
</div>
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 分页样式 */
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持硕编程。
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!