www.gusucode.com > 08CMS空白站群系统 3.3 繁体 UTF-8 > upload/include/parse/mpnav.php
<?php !defined('M_COM') && exit('No Permission'); function mpnav($temparr=array(),$virtualurl=0,$s_num=0){ global $btags; extract($temparr,EXTR_OVERWRITE); if($pcount < 2) return ''; $static = empty($static) ? 0 : $static; $simple = empty($simple) ? 0 : $simple; $length = empty($length) ? 10 : $length; $s_num = empty($s_num) ? $pcount : min($pcount,$s_num); $virtualurl && en_virtual($durlpre); $offset = 2; if($length > $pcount){ $from = 1; $to = $pcount; }else{ $from = $nowpage - $offset; $to = $from + $length - 1; if($from < 1){ $to = $nowpage + 1 - $from; $from = 1; if($to - $from < $length) $to = $length; }elseif($to > $pcount){ $from = $pcount - $length + 1; $to = $pcount; } } $mpnav = ''; $suffix = $virtualurl ? '.html' : ''; $btags['mppage'] = $nowpage; $btags['mpcount'] = $pcount; $btags['mpacount'] = $acount; $btags['mpstart'] = $static ? ($surlpre.'1.html') : ($durlpre.'1'.$suffix); $btags['mpend'] = ($static && $pcount <= $s_num) ? ($surlpre.$pcount.'.html') : ($durlpre.$pcount.$suffix); $btags['mppre'] = $nowpage > 1 ? (($static && ($nowpage - 1) <= $s_num) ? ($surlpre.($nowpage - 1).'.html') : ($durlpre.($nowpage - 1).$suffix)) : '#'; $btags['mpnext'] = $nowpage < $pcount ? (($static && ($nowpage + 1) <= $s_num) ? ($surlpre.($nowpage + 1).'.html') : ($durlpre.($nowpage + 1).$suffix)) : '#'; if($nowpage - $offset > 1 && $pcount > $length) $mpnav .= '<a href="'.$btags['mpstart'].'" class="p_redirect">|<</a>'; if($nowpage > 1 && !$simple) $mpnav .= '<a href="'.$btags['mppre'].'" class="p_redirect"><<</a>'; for($i = $from; $i <= $to; $i++){ $mpnav .= $i == $nowpage ? '<a class="p_curpage">'.$i.'</a>' : (($static && $i <= $s_num) ? '<a href="'.$surlpre.$i.'.html" class="p_num">'.$i.'</a>' : '<a href="'.$durlpre.$i.$suffix.'" class="p_num">'.$i.'</a>'); } if($nowpage < $pcount && !$simple) $mpnav .= '<a href="'.$btags['mpnext'].'" class="p_redirect">>></a>'; if($to < $pcount) $mpnav .= '<a href="'.$btags['mpend'].'" class="p_redirect">>|</a>'; $mpnav = $mpnav ? '<div class="p_bar">'.(!$simple ? '<a class="p_total"> '.$acount.' </a><a class="p_pages"> '.$nowpage.'/'.$pcount.' </a>' : '').$mpnav.'</div>' : ''; return $mpnav; } ?>