首页 > php教程 > php手册 > 正文

ThinkPHP分页

WBOY
发布: 2016-06-13 10:44:34
原创
973 人浏览过

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); 
    } 

4.
Php代码 

{$page}
 
               
                 
                   
                   
                   
                   
                   
                   
                   
                   
                 
                 
                     
                         
                           
 
                               
                               
                               
                               
                               
                               
                               
                               
                             
                         
                         
                           
 
                               
                               
                               
                               
                               
                               
                               
                               
                             
                         
                     
                 
             
ID描述路径备注级别父导航Id编辑删除
{$vo.Id}{$vo.description}{$vo.addr}{$vo.remarks}{$vo.level}{$vo.parsentId}EditDelete
{$vo.Id}{$vo.description}{$vo.addr}{$vo.remarks}{$vo.level}{$vo.parsentId}EditDelete
 
             
{$page}
 

作者“pyzheng”
 

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板