分页|関数数
// 分页显示:[1]... [<<] - [<] [9] [10] [11] [12] [13] [14] [15] [16] [> ] - [>>] ...[232]
// URL 形式: ./list.php?page= ;システムは URL の後に Pagenum を自動的に追加します
// $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 = 15、$perlist = 8) {
if ($total
if ($curpage $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
$ret = '';
if ($curlist > 1) {
$ret .= "[1]...n";
$ret .= "[<<] -n";
}
if ($curpage > 1)
$ret .= "[<]n";
do {
if ($botpage == $curpage)
$ret .= "[" . $botpage . "]n";
else
$ret .= "[" . $botpage . "]n";
} while ($botpage++ < $toppage);
if ($totalpage > $curpage)
$ret .= "< ;a title="下一页" href="" 。 $url 。 ($curpage + 1) 。 "">[>]n";
if ($totallist > $curlist) {
$ret .= "- [>>]n";
$ret .= "...[" . $totalpage . "]n";
}
$ret .= "合計: " . $total;
return ($ret);
}