Chinaunix

标题: page.php [打印本页]

作者: TX    时间: 2006-09-26 15:25
标题: page.php
getGopageRs($sql)配合使用
* 调用显示模式 $gopage->style();允许为空。默认为样式0,可以填写0-2,出现不同模式
*/
Class GoPage{
var $tpages;//总页数
var $tcounts;//总记录数
var $page;
var $deferentparameter;
var $selfvariable;
        function Gopage($tpages,$tcounts){
            global $page;
            global $deferentparameter;
            global $selfvariable;
            $page=$_REQUEST["page"];
            $this->tpages = $tpages;
            $this->tcounts = $tcounts;
            if($page==0 || $page==""){
                $this->page = 1;
            }else{
                $this->page = $page;
            }
            if($page > $this->tpages){
                    $this->page = $this->tpages;
            }
            $this->deferentparameter = $deferentparameter;
            $this->selfvariable = $selfvariable;
        }
        function style($slectflag=""){
                switch($slectflag){
                        case "0": $this->style0();
                        break;
                        case "1": $this->style1();
                        break;
                        case "2": $this->style2();
                        break;
                        default: $this->style0();
                }
        }
        function style0(){
         $fontcolor = "#CB5C0B";
?>
        
                  
                        共">tcounts?>条记录
               
                  
                        第">page?>页/ 共">tpages?>页
               
                  
                page>1){?>
                        ?page=1deferentparameter.$this->selfvariable?>">第一页
               
                        第一页
               
               
                  
                page>1){?>
                        ?page=page-1?>deferentparameter.$this->selfvariable?>">上一页
               
                        上一页
               
               
                  
                pagetpages){?>
                        ?page=page+1?>deferentparameter.$this->selfvariable?>">下一页
               
                        下一页
               
               
                  
                pagetpages){?>
                        ?page=tpages?>deferentparameter.$this->selfvariable?>">末一页
               
                        末一页
               
               
                  
                        
                        tpages;$pagei++){
                                if($pagei+1==$this->page){
                                        $tempselect = "selected";
                                }else{
                                        $tempselect = "";
                                }
                        ?>
                        ?page=deferentparameter.$this->selfvariable?>" >去页
                        
                        
               
        
        
                   
                        共">tcounts?>条记录
               
                  
                        第">page?>页/ 共">tpages?>页
               
                  
                page>1){?>
                        ?page=1deferentparameter.$this->selfvariable?>">第一页
               
                        第一页
               
               
                  
                page>1){?>
                        ?page=page-1?>deferentparameter.$this->selfvariable?>">上一页
               
                        上一页
               
               
                  
                pagetpages){?>
                        ?page=page+1?>deferentparameter.$this->selfvariable?>">下一页
               
                        下一页
               
               
                  
                pagetpages){?>
                        ?page=tpages?>deferentparameter.$this->selfvariable?>">末一页
               
                        末一页
               
               
                  去
                        "
                                value="page?>" maxlength="tpages)?>"
                                style="width:tpages)*10?>px;font-size:9pt;height:18px;font-family:'宋体'"
                                 onFocus="this.select()" dir="rtl">
                        页
                        
               
        
  
       共">
      tcounts?>
      条记录
       第">
      page?>
      页/ 共">
      tpages?>
      页
      
      page>1){?>
      ?page=1deferentparameter.$this->selfvariable?>">第一页
      
      第一页
      
   
      
      page>1){?>
      ?page=page-1?>deferentparameter.$this->selfvariable?>">上一页
      
      上一页
      
   
      
      pagetpages){?>
      ?page=page+1?>deferentparameter.$this->selfvariable?>">下一页
      
      下一页
      
   
      
      pagetpages){?>
      ?page=tpages?>deferentparameter.$this->selfvariable?>">末一页
      
      末一页
      
   
  


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/18908/showart_176822.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2