php分頁類_PHP教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:用php實(shí)現(xiàn)簡單的滑動(dòng)菜單<style> table {font-size = 9pt} td {height = 20px} </style> <body> <span id="menus"></span> <span id="view"&g
<?php//
// ----------------------------------------------------------------------
// | 分頁類 |
// ----------------------------------------------------------------------
// | Copyright (c) 2001 NetFish Software |
// | |
// | Author: whxbb([email protected]) |
// ----------------------------------------------------------------------
//
// $Id: pager.class.php,v 0.1 2001/8/2 13:18:13 yf Exp $
//
// 禁止直接訪問該頁面
if (basename($HTTP_SERVER_VARS['PHP_SELF']) == "pager.class.php") {
header("HTTP/1.0 404 Not Found");
}
/**
* 分頁類
* Purpose
* 分頁
*
* @author : whxbb([email protected])
* @version : 0.1
* @date : 2001/8/2
*/
class Pager
{
/** 總信息數(shù) */
var $infoCount;
/** 總頁數(shù) */
var $pageCount;
/** 每頁顯示條數(shù) */
var $items;
/** 當(dāng)前頁碼 */
var $pageNo;
/** 查詢的起始位置 */
var $startPos;
var $nextPageNo;
var $prevPageNo;
function Pager($infoCount, $items, $pageNo)
{
$this->infoCount = $infoCount;
$this->items = $items;
$this->pageNo = $pageNo;
$this->pageCount = $this->GetPageCount();
$this->AdjustPageNo();
$this->startPos = $this->GetStartPos();
}
function AdjustPageNo()
{
if($this->pageNo == '' || $this->pageNo < 1)
$this->pageNo = 1;
if ($this->pageNo > $this->pageCount)
$this->pageNo = $this->pageCount;
}
/**
* 下一頁
*/
function GoToNextPage()
{
$nextPageNo = $this->pageNo 1;
if ($nextPageNo > $this->pageCount)
{
$this->nextPageNo = $this->pageCount;
return false;
}
$this->nextPageNo = $nextPageNo;
return true;
}
/**
* 上一頁
*/
function GotoPrevPage()
{
$prevPageNo = $this->pageNo - 1;
if ($prevPageNo < 1)
{
$this->prevPageNo = 1;
return false;
}
$this->prevPageNo = $prevPageNo;
return true;
}
function GetPageCount()
{
return ceil($this->infoCount / $this->items);
}
function GetStartPos()
{
return ($this->pageNo - 1) * $this->items;
}
}
?>
分享:用PHP操縱Oracle的LOB類型的數(shù)據(jù)用過Oracle的人都知道,Oracle有一種數(shù)據(jù)類型叫VARCHAR2,用來表示不定長的字符串。VARCHAR2也是Oracle公司推薦使用的類型。但使用VARCHAR2有個(gè)問題:最大只能表示4000個(gè)字符,也就相當(dāng)于2000個(gè)
相關(guān)PHP教程:
- PHPNOW安裝Memcached擴(kuò)展方法詳解
- php記錄頁面代碼執(zhí)行時(shí)間
- PHP中獎(jiǎng)概率的抽獎(jiǎng)算法程序代碼
- apache設(shè)置靜態(tài)文件緩存方法介紹
- php對(duì)圖像的各種處理函數(shù)代碼小結(jié)
- PHP 關(guān)于訪問控制的和運(yùn)算符優(yōu)先級(jí)介紹
- 關(guān)于PHP語言構(gòu)造器介紹
- php/js獲取客戶端mac地址的實(shí)現(xiàn)代碼
- php5.5新數(shù)組函數(shù)array_column使用
- PHP preg_match的匹配多國語言的技巧
- php 中序列化和json使用介紹
- php采集文章中的圖片獲取替換到本地
PHP教程Rss訂閱編程教程搜索
PHP教程推薦
- 創(chuàng)建XML Http Request對(duì)象兩個(gè)的方法
- 用php制作簡單分頁(從數(shù)據(jù)庫讀取記錄)的方法詳解
- 關(guān)于尾遞歸的使用詳解
- 用PHP程序?qū)崿F(xiàn)刪除目錄的三種方法實(shí)例
- PHP容易忘記的知識(shí)點(diǎn)分享
- php5 MySQL5 apache2 phpmyadmin ZendOptimizer安裝與配置
- 將IP地址轉(zhuǎn)換為整型數(shù)字的PHP方法、Asp方法和MsSQL方法、MySQL方法
- PHP MySQL分頁顯示分析
- 在同一窗體中使用PHP來處理多個(gè)提交任務(wù)
- 十個(gè)學(xué)習(xí)PHP必備的技巧
- 相關(guān)鏈接:
- 教程說明:
PHP教程-php分頁類
。