程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> 今天寫的分頁類......分享

今天寫的分頁類......分享

編輯:關於PHP編程

由於是上班時候寫的,所以如果全部由部貼出來恐怕對不起公司,所以我把其中的表單跳轉刪去了。別見怪哦。。。 格式寫法是比較標准的了 PHP代碼:-------------------------------------------------------------------------------- /********** | +--------------------------------------------------- | CLASS NAME: PageBar | +--------------------------------------------------- | Author: Arvan [E-mail:[email protected] QQ:8817776] | Create date: 2003-7-17 | Note: | Do for pagination | +--------------------------------------------------- | Warning: no... | +--------------------------------------------------- **********/ class PageBar { var $total; var $onepage; var $num; var $pagecount; var $total_page; var $offset; var $linkhead; function PageBar($total, $onepage, $form_vars=) { $pagecount = $_GET[pagecount]; $this->total = $total; $this->onepage = $onepage; $this->total_page = ceil($total/$onepage); if (empty($pagecount)) { $this->pagecount = 1; $this->offset = 0; } else { $this->pagecount = $pagecount; $this->offset = ($pagecount-1)*$onepage; } if (!empty($form_vars)) { $vars = explode("|", $form_vars); $chk = $vars[0]; $chk_value = $_POST[$chk]; if (empty($chk_value)) { $formlink = ""; } else { for ($i=0; $ilinkhead = $_SERVER[PHP_SELF]."?".$formlink; } else { $this->linkhead = $_SERVER[PHP_SELF]."?".$linkft.$formlink; } } #End function PageBar(); function offset() { return $this->offset; } #End function offset(); function pre_page($char=) { $linkhead = $this->linkhead; $pagecount = $this->pagecount; if (empty($char)) { $char = "[<]"; } if ($pagecount>1) { $pre_page = $pagecount - 1; return "$char"; } else { return ; } } #End function pre_page(); function next_page($char=) { $linkhead = $this->linkhead; $total_page = $this->total_page; $pagecount = $this->pagecount; if (empty($char)) { $char = "[

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved