- // 1 2 3 4 5 6 7 8
- // 8 7 6 5 4 3 2 1
- //列表分页 倒序
- function list_multi($num, $perpage, $curpage,$mpurl, $dynamic= false) {
- global $_SC;
-
- $_SC['fileext'] = empty($_SC['fileext'])? 'html':$_SC['fileext'];
- if($dynamic) {
- return multi($num, $perpage, $curpage, $mpurl);
- }
-
- $return = '';
- if($num >= $perpage) {
- $return = '<em>'.$num.'</em>';
- $start = max($curpage-intval($perpage/2),1);
- $end = min($start+$perpage-1,$num);
- $start = max(1,$end-$perpage+1);
-
- $return .= '<a href="'.$mpurl.'_'.$num.'.'.$_SC['fileext'].'" class="first">First</a>';
- $return .= ($curpage == 1)?'<a href="'.$mpurl.'_'.$curpage.'.'.$_SC['fileext'].'" class="prev">Prev</a>':'<a href="'.$mpurl.'_'.($num-$curpage+2).'.'.$_SC['fileext'].'" class="prev">Prev</a>';
- for($i = $start;$i<=$end;$i++) {
- $return .= ($curpage == $i)?'<strong>'.$i.'</strong>'
- :(($i-1 ==0)?'<a href="'.$mpurl.'_'.($num+1-$i).'.'.$_SC['fileext'].'" >'.$i.'</a>':'<a href="'.$mpurl.'_'.($num+1-$i).'.'.$_SC['fileext'].'" >'.$i.'</a>');
- }
- $return .= ($curpage == $num)?'<a href="'.$mpurl.'_'.($curpage).'.'.$_SC['fileext'].'" class="next">Next</a>':'<a href="'.$mpurl.'_'.($num-$curpage).'.'.$_SC['fileext'].'" class="Next">Next</a>';
- $return .= '<a href="'.$mpurl.'_1.'.$_SC['fileext'].'" class="last">Last</a>';
- }
- return $return;
- }
复制代码 |