平時在寫php程式的時候,有些重複使用到的程式**總會浪費大量的時間,現貼出本人經常使用的php分頁**,僅供參考。
以下是php**:
<?php
class pageview
/*** 分頁演算法
* @return
*/private function generatepagelist()
}else
array_push($pagelist,-1);
array_push($pagelist,$this->pagecount);
}else if($this->pageno > $this->pagecount - 4)
}else if($this->pageno > 4 && $this->pageno <= $this->pagecount - 4)
}return $pagelist;
}/***
* 建立分頁控制項
* @param
* @return string
*/public function echopageasdiv()
foreach ($pagelist as $k=>$p)
if($p == -1)
$pagestring = $pagestring ."jsfunction . "(" . $p . ")\">" . $p . "";
}if($this->hasnextpage)}}
$pagestring = $pagestring .("
"); return $pagestring;
}}?>
下面是css的樣式**:
.pagination
.pagination-tab
.pagination a, .pagination .page-cur, .pagination .page-prev_g, .pagination .page-prev, .pagination .page-next, .pagination .page-next_g, .pagination .page-break, .pagination .page-skip
.pagination a, .pagination .page-prev_g, .pagination .page-prev, .pagination .page-next, .pagination .page-next_g, .pagination .page-cur, .pagination .page-break
.pagination a:hover
.pagination .page-prev_g, .pagination .page-prev, .pagination .page-next, .pagination .page-next_g
.pagination .page-prev
.pagination .page-prev_g
.pagination .page-next
.pagination .page-next_g
.pagination .page-cur
.pagination .page-break
以下是php頁面呼叫的**:
//php呼叫
$pageno = $_get['pageno'];
if(empty($pageno))
//分頁資料
$pagedata = news::getnewspage($pageno,$pagesize);
//取得總行數
$count = news::getnewscount();
//建立分頁器
$p = new pageview($count['0']['total'],$pagesize,$pageno,$pagedata);
//生成頁碼
$pageviewstring = $p->echopageasdiv();
經典的jsp分頁顯示
page contenttype text html charset gb2312 page language j a import j a.sql.script language j ascript function newwin url script script language j ascr...
asp分頁技術 經典
language vbscript codepage 936 姓名所屬分類 編號使用者編號 set rs server.createobject adodb.recordset sql select from syscolumns rs.open sql,conn,1,1 if not rs.eof...
SQL Server 儲存過程的經典分頁
建立表 create table testtable id int identity 1,1 not null firstname nvarchar 100 collate chinese prc ci as null lastname nvarchar 100 collate chinese pr...