/前台分页函数
function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = TRUE, $simple = FALSE) {
//global $maxpage;
$ajaxtarget = !empty($_GET['ajaxtarget']) ? " ajaxtarget="".htmlspecialchars($_GET['ajaxtarget'])."" " : '';
$multipage = '';
$mpurl .= strpos($mpurl, '?') ? '&' : '?';
$realpages = 1;
if($num > $perpage) {
$offset = 2;
$realpages = @ceil($num / $perpage);
$pages = $maxpages && $maxpages
//$curpage = $curpage
if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $curpage - $offset;
$to = $from + $page - 1;
if($from
$to = $curpage + 1 - $from;
$from = 1;
if($to - $from
$to = $page;
}
} elseif($to > $pages) {
$from = $pages - $page + 1;
$to = $pages;
}
}
$multipage = ($curpage - $offset > 1 && $pages > $page ? '1 ...' : '').
($curpage > 1 && !$simple ? '‹‹' : '');
for($i = $from; $i
$multipage .= $i == $curpage ? ''.$i.'' :
''.$i.'';
}
$multipage .= ($curpage ››' : '').
($to ... '.$realpages.'' : '').
(!$simple && $pages > $page && !$ajaxtarget ? '' : '');
$multipage = $multipage ? '