TP自带分页类样式,以及使用

xiaoxiao2021-02-28  106

先看一下样式,感觉还挺漂亮的。只需要在页面引入class="pages"

{

<tfoot> <!--分页显示?--> <tr><td textalign="center" cl nowrap="true" colspan="9" height="20"><div class="pages"><?php echo $page; ?></div></td></tr> </tfoot>下面是css样式: .pages{float: right} .pages a,.pages span { display:inline-block; padding:2px 10px; border:1px solid #f0f0f0; -webkit-border-radius:3px; -moz-border-radius:3px; border-radius:3px; font-size: 14px; } .pages a,.pages li { display:inline-block; list-style: none; text-decoration:none; color:#58A0D3; } .pages a.first,.pages a.prev,.pages a.next,.pages a.end{ margin:0 auto; } .pages a:hover{ border-color:#50A8E6; } .pages span.current{ background:#50A8E6; color:#FFF; font-weight:700; border-color:#50A8E6; } 分页类可在Model或者Controller里面: $count = $this->alias('a')->join('*****')->where($where)->count('distinct a.id'); $page = new \Think\Page($count, $pageSize); // 配置翻页的样式 $page -> setConfig('header','<li class="rows"><b>%TOTAL_ROW%</b>条记录 <b>%NOW_PAGE%</b>/<b>%TOTAL_PAGE%</b></li>'); $page->setConfig('last', '末页'); $page->setConfig('first', '首页'); $page -> setConfig('prev','上一页'); $page -> setConfig('next','下一页'); $page->setConfig('theme', '%FIRST%%UP_PAGE%%LINK_PAGE%%DOWN_PAGE%%END%%HEADER%'); $pageString = $page->show();
转载请注明原文地址: https://www.6miu.com/read-33106.html

最新回复(0)