首頁 >php教程 >php手册 >PHP技巧:Smarty+adodb分页示例

PHP技巧:Smarty+adodb分页示例

WBOY
WBOY原創
2016-06-21 08:58:041730瀏覽

利用Smarty+adodb分页示例, 下面给出的是分页部份的代码。

分页文件:page.lbi

以下为引用的内容:


 
   
    
   
   
当前页 /
      
       [ 首页 ]
      
       [ 首页 ]
      
      
       [ 上一页 ]
      
       [ 上一页 ]
      
      
       [ 下一页 ] 
      
       [ 下一页 ]
      
      
       [ 末页 ]   
      
       [ 末页 ]
      
       转到 字串6
      
   

php部份....

以下为引用的内容:

    // level E member's product commend list
    public function product_comm($size = 5){  
    $pre  = $size 5 && !empty($_REQUEST['lb'])  ? " AND prolb LIKE '%".$_REQUEST['lb']."%' " : "";
       $this->where = " judge_flag = 0 AND pubname = '".$_REQUEST['user']."' $pre ";
       $sql = " SELECT id, pingpai, img, huohao FROM user_proinfo  WHERE ".$this->where.
        " ORDER BY pubtime DESC ";
    $res = $this->selectRs->SelectLimit($sql, $size, ($this->page - 1) * $size );
    $this->NaviPage_cM("`user_proinfo`", $size, $this->where);
    return $res;  
    }
   // embed in all must be used cat page function
   private function NaviPage_cM($table, $size, $where){
      $count = $this->selectRs->GetOne("SELECT COUNT(*) FROM $table WHERE $where ");
   $pages = @ceil($count/$size);
      for ($i = 0; $i       $navi_cM = array(   "option"     =>  $arr,
                     "page"      =>  $this->page,
                     "pages"     =>  $pages,
                     "count"     =>  $count, 字串7
                     "size"      =>  $size,
                     "param"     =>  $this->param
                    );
      $this->tpl->assign("navi_cM", $navi_cM);
   }



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn