Thinkphp 分页样式修改为 Bootstrap 分页版本


Thinkphp分页样式改造成Bootstrap版本,还是非常简单的。

1.修改类库,目录:ThinkPHP/Extend/Library/ORG/Util/Page.class.php
把所有分页的样式加上<li></li>标签

2.程序调用类库,关键是$Page->setConfig

$m = M('Message');
		import('ORG.Util.Page');
		$count = $m->count();
		$Page = new Page($count,3);
		$Page->setConfig('header','篇文章');
		$Page->setConfig('theme', '<li><a>共 %totalRow% %header%</a></li> <li>%upPage% %first%  %prePage%  %linkPage%  %nextPage% %end% %downPage%</li>');
		$show = $Page->show();
		$data = $m->order('mid DESC')->limit($Page->firstRow.','.$Page->listRows)->select();
		$this->assign('show',$show);
		$this->assign('data',$data);
		$this->display();

4.模板内容

<div class="page">
    <ul>
      <{$show}>
    </ul>
 </div>

引用Bootstrap后的样子:
page

Jason.wang

When you find your talent can't afford to be ambitious, be quiet and study !

You may also like...