public function selectP($num = 10, $options = array()) {//默认10条数据
$options = $this->_parseOptions($options)
$this->options = $options
$_count = $this->count()
$_page = new \Think\Page($_count, $num)
$_res['list'] = $this->order('id')->limit($_page->firstRow . ',' . $_page->listRows)->select($options)
$_res['page'] = $_page->show()
return $_res
}
返回的数组:
[
'list'=>[[],[],[]...],//数据
'page'=>"<div class='page'><a>......</a></div>"//分页html
]
复制代码
css
div.badoo {
width: 80%
padding: 10px 0px
font-size: 13px
color: #48b9ef
font-family: arial, helvetica, sans-serif
background-color: #fff
text-align: center
margin: 5px auto
}
div.badoo a {
border: #f0f0f0 2px solid
padding: 2px 5px
margin: 0px 3px
border-left: #f0f0f0 2px solid
color: #48b9ef
text-decoration: none
}
div.badoo a:hover {
border: #ff5a00 2px solid
color: #ff5a00
}
div.badoo a:active {
border: #ff5a00 2px solid
color: #ff5a00
}
div.badoo span.current {
border: #ff5a00 2px solid
padding: 2px 5px
font-weight: bold
color: #fff
background-color: #ff6c16
}
div.badoo span.disabled {
display: none
}
复制代码
html,$a为selectP的结果,传递到html的数组变量
<ul>
<volist name='a.list' id='vo'>
<li>
{$vo.name}
</li>
</volist>
</ul>
<div class="badoo">
{$a.page}
</div>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)