phpcms\modules\wap\functions\global.func.php
在 global.func.php 文件中对应的函数为:wpa_pages
function wpa_pages($num, $curr_page, $perpage = 20, $urlrule = '', $array = array(),$setpages = 10) {
if(defined('URLRULE')) {
$urlrule = URLRULE;
$array = $GLOBALS['URL_ARRAY'];
} elseif($urlrule == '') {
$urlrule = url_par('page={$page}');
}
$multipage = '';
if($num > $perpage) {
$page = $setpages+1;
$offset = ceil($setpages/2-1);
$pages = ceil($num / $perpage);
if (defined('IN_ADMIN') && !defined('PAGES')) define('PAGES', $pages);
$from = $curr_page - $offset;
$to = $curr_page + $offset;
$more = 0;
if($page >= $pages) {
$from = 2;
$to = $pages-1;
} else {
if($from <= 1) {
$to = $page-1;
$from = 2;
} elseif($to >= $pages) {
$from = $pages-($page-2);
$to = $pages-1;
}
$more = 1;
}
$multipage .= $curr_page.'/'.$pages;
if($curr_page>0) {
if($curr_page == '1'){
$multipage .= ' <a href="'.pageurl($urlrule, $curr_page-1, $array).'">首页</a>';
}else{
$multipage .= ' <a href="'.pageurl($urlrule, $curr_page-1, $array).'">'.L('previous').'</a>';
}
}
if($curr_page==$pages) {
$multipage .= ' <a href="'.pageurl($urlrule, $curr_page, $array).'">末页</a>';
} else {
$multipage .= ' <a href="'.pageurl($urlrule, $curr_page+1, $array).'">'.L('next').'</a>';
}
}
return $multipage;
}