Phpcms V9列表分页自定义页码文字(改成中文)
//自定义分页函数
function pages_my($num, $curr_page, $perpage = 20, $urlrule = '', $array = array(),$setpages = 10) {
if(defined('URLRULE') && $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 .= ''.$num.L('page_item_my').'';
if($curr_page>0) {
$multipage .= ' '.L('previous_my').'';
if($curr_page==1) {
$multipage .= ' 1';
} elseif($curr_page>6 && $more) {
$multipage .= ' 1..';
} else {
$multipage .= ' 1';
}
}
for($i = $from; $i <= $to; $i++) {
if($i != $curr_page) {
$multipage .= ' '.$i.'';
} else {
$multipage .= ' '.$i.'';
}
}
if($curr_page<$pages) {
if($curr_page<$pages-5 && $more) {
$multipage .= ' ..'.$pages.' '.L('next_my').'';
} else {
$multipage .= ' '.$pages.' '.L('next_my').'';
}
} elseif($curr_page==$pages) {
$multipage .= ' '.$pages.' '.L('next_my').'';
} else {
$multipage .= ' '.$pages.' '.L('next_my').'';
}
}
return $multipage;
}
本站资源均来自互联网或会员发布,如果不小心侵犯了您的权益请与我们联系。我们将立即删除!谢谢!