演示效果:
相关代码:
if(URL_MODEL == 3){ $pages .= $page<=1 ? '<a class="no-page page-prev">'.L('pre_page').'</a>' : '<a href="?page=1">'.L('home_page').'</a> <a href="?page='.($page-1).'" class="page-prev">'.L('pre_page').'</a>'; if($total_page<=5){ for($i=1; $i<=$total_page; $i++){ $pages.= $i==$page ? '<a class="curpage">'.$i.'</a>' : '<a href="?page='.$i.'">'.$i.'</a>'; } }else{ $p = ($page-4)<=1 ? 1 : $page-4; $n = ($page+4)>=$total_page ? $total_page : $page+4; for($i=$p; $i<=$n; $i++){ $pages.= $i==$page ? '<a class="curpage">'.$i.'</a>' : '<a href="?page='.$i.'">'.$i.'</a>'; } } $pages .= $page>=$total_page ? '<a class="no-page page-next">'.L('next_page').'</a>' : '<a href="?page='.($page+1).'" class="page-next">'.L('next_page').'</a> <a href="?page='.$total_page.'">'.L('end_page').'</a>'; }else{ yzm_base::load_sys_class('page','',0); $page = new page($total_page, 1); $pages .= $page->getpre().$page->getlist().$page->getnext(); }