ThinkPHP分页
程序员文章站
2024-01-10 08:15:10
...
1.下载官方有例子的包,然后找到例子下面的Page例子。
2. 找到Page.class.php,复制到你自己的项目ThinkPHP/Lib/Think/Util下面。
3.
Php代码
public function doPage(){
//echo $_GET["p"];
if(emptyempty($_GET["p"]))
$this->assign('p', 1);
else
$this->assign('p', $_GET["p"]);
$Nav = M("navigation");
$count = $Nav->count();
import("ORG.Util.Page");
$p = new Page($count, 10);
$page = $p->show();
$list = $Nav->order('Id ASC')->limit($p->firstRow.','.$p->listRows)->select();
$this->assign('page', $page);
$this->assign("list",$list);
}
2. 找到Page.class.php,复制到你自己的项目ThinkPHP/Lib/Think/Util下面。
3.
Php代码
public function doPage(){
//echo $_GET["p"];
if(emptyempty($_GET["p"]))
$this->assign('p', 1);
else
$this->assign('p', $_GET["p"]);
$Nav = M("navigation");
$count = $Nav->count();
import("ORG.Util.Page");
$p = new Page($count, 10);
$page = $p->show();
$list = $Nav->order('Id ASC')->limit($p->firstRow.','.$p->listRows)->select();
$this->assign('page', $page);
$this->assign("list",$list);
}
4.
Php代码
{$page}
ID | 描述 | 路径 | 备注 | 级别 | 父导航Id | 编辑 | 删除 |
---|---|---|---|---|---|---|---|
{$vo.Id} | {$vo.description} | {$vo.addr} | {$vo.remarks} | {$vo.level} | {$vo.parsentId} | Edit | Delete |
{$vo.Id} | {$vo.description} | {$vo.addr} | {$vo.remarks} | {$vo.level} | {$vo.parsentId} | Edit | Delete |
{$page}
作者“pyzheng”