Page Pagination | functions
Paging display: [1] ... [<<]-[[A] [9] [A] [one] [[A] [[a]] [[a]] [m]-[>>] [232]
URL Format:./list.php?page=; System'll add the Pagenum after the URL automaticly
$Id: Split_page.php,v 1.1.1.1 2002/08/24 14:26:41 hightman EXP $
function Split_page ($url, $total, $curpage = 1, $perpage =, $perlist = 8) {
if ($total <= 0) return;
if ($curpage <= 0) $curpage = 1;
$totalpage = Ceil ($total/$perpage);
$totallist = Ceil ($totalpage/$perlist);
if ($curpage > $totalpage) $curpage = $totalpage;
$curlist = Ceil ($curpage/$perlist);
$toppage = $curlist * $perlist;
if ($toppage > $totalpage) $toppage = $totalpage;
$botpage = ($curlist-1) * $perlist + 1;
if ($botpage < 1) $botpage = 1;
$ret = ';
if ($curlist > 1) {
$ret. = "<a title=\" first page \ href=\ "". $url. "1\" >[1]</a>...\n ";
$ret. = "<a title=\" previous column \ "Href=\". $url. ($botpage-$perlist). " \ ">[<<]</a>-\n";
}
if ($curpage > 1)
$ret. = "<a title=\" previous page \ href=\ "". $url. ($curpage-1). "\" >[<]</a>\n ";
do {
if ($botpage = = $curpage)
$ret. = "<b><font color=red>[". $botpage. "]</font></b>\n";
Else
$ret. = "<a title=\". $botpage. "Page \" Href=\ "". $url. $botpage. "\" >[". $botpage. "]</a>\n";
while ($botpage + + < $toppage);
if ($totalpage > $curpage)
$ret. = "<a title=\" next page \ href=\ "". $url. ($curpage + 1). "\" >[>]</a>\n ";
if ($totallist > $curlist) {
$ret. = "-<a title=\" the next column \ href=\ "". $url. ($toppage + 1). "\" >[>>]</a>\n ";
$ret. = "... <a title=\" last page \ href=\ "". $url. $totalpage. "\" >[". $totalpage. "]</a>\n";
}
$ret. = "Total:". $total;
return ($ret);
}