欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

thinkPHP中分頁(yè)用法實(shí)例分析

 更新時(shí)間:2015年12月26日 10:42:14   作者:釋然me  
這篇文章主要介紹了thinkPHP中分頁(yè)用法,結(jié)合實(shí)例形式詳細(xì)分析了thinkPHP數(shù)據(jù)查詢及使用分頁(yè)類實(shí)現(xiàn)分頁(yè)效果的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了thinkPHP中分頁(yè)用法。分享給大家供大家參考,具體如下:

拿一個(gè)實(shí)例來(lái)說吧

action頁(yè)面:

public function show(){
   import("ORG.Util.Page"); //導(dǎo)入分頁(yè)類
   $news=D("News");
   $count = $news->where('`content_type`='.$id)->count(); //查詢記錄的總條數(shù)
   $p = new Page($count, 10);
   $list = $contact->where('`content_type`='.$id)->order('sort')->limit($p->firstRow . ',' . $p->listRows)->select(); 
   $p->setConfig('header', '條數(shù)據(jù)'); //分頁(yè)樣式可自定義
   $p->setConfig('prev', "<"); 
   $p->setConfig('next', '>'); 
   $p->setConfig('first', '<<'); 
   $p->setConfig('last', '>>'); 
   $page = $p->show(); //分頁(yè)的導(dǎo)航條的輸出變量
   $this->assign("page",$page); //在模板頁(yè)面中輸出分頁(yè)
   $this->assign('info',$list); //查詢的信息反饋到模板頁(yè)面中
   $this->display('index');
}

調(diào)用的tpl頁(yè)面:index.php

自定義的css樣式,主要用于分頁(yè)樣式

<style type="text/css">
.page{
 font-size:18px;
}
.page .current{
 width:10px;
 font-size:16px;
 margin-left:5px;
 padding:2px;
 border:1px solid #000;
}
.page a{
 min-width:10px;
 font-size:16px;
 margin-left:5px;
 border:1px solid #000;
 padding:2px;
}
</style>

循環(huán)輸出分頁(yè)信息

................
...............
...............
<div class="page"> {$page} </page> <!-- 輸出分頁(yè)信息 -->

分頁(yè)樣式如下:

可根據(jù)需要自定義所需的樣式

希望本文所述對(duì)大家基于thinkPHP框架的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論