diff options
-rw-r--r-- | lib/base.php | 31 | ||||
-rw-r--r-- | templates/part.pagenavi.php | 31 |
2 files changed, 39 insertions, 23 deletions
diff --git a/lib/base.php b/lib/base.php index ec305250809..352474e1e83 100644 --- a/lib/base.php +++ b/lib/base.php @@ -242,35 +242,20 @@ class OC_UTIL { public static function showPageNavi($pagecount,$page,$url) { $pagelinkcount=8; - $txt=''; if ($pagecount>1) { - $txt.='<center><table class="pager" cellspacing="0" cellpadding="0" border="0"><tr><td width="1">'; - - if ($page>'0') { - $txt.='<span class="pagerbutton1"><a href="'.$url.($page-1).'">prev</a> </span>'; - } - $txt.='</td><td width="1">'; - $pagestart=$page-$pagelinkcount; if($pagestart<0) $pagestart=0; $pagestop=$page+$pagelinkcount; if($pagestop>$pagecount) $pagestop=$pagecount; - if ($pagestart<>0) $txt.='...'; - for ($i=$pagestart; $i < $pagestop;$i++) { - if ($i<>$page) { - $txt.='<a href="'.$url.$i.'"> '.($i+1).' </a>'; - } else { - $txt.=' <b>'.($i+1).'</b> '; - } - } - if ($pagecount>$pagestop) $txt.='...'; - $txt.='</td><td width="1">'; - if (($page+1)<$pagecount) { - $txt.='<span class="pagerbutton2"><a href="'.$url.($page+1).'">next</a></span>'; - } - $txt.='</td></tr></table></center>'; + + $tmpl = new OC_TEMPLATE( '', 'part.pagenavi', '' ); + $tmpl->assign('page',$page); + $tmpl->assign('pagecount',$pagecount); + $tmpl->assign('pagestart',$pagestart); + $tmpl->assign('pagestop',$pagestop); + $tmpl->assign('url',$url); + $tmpl->printPage(); } - echo($txt); } diff --git a/templates/part.pagenavi.php b/templates/part.pagenavi.php new file mode 100644 index 00000000000..1bb99b6173b --- /dev/null +++ b/templates/part.pagenavi.php @@ -0,0 +1,31 @@ +<center> + <table class="pager" cellspacing="0" cellpadding="0" border="0"> + <tr> + <td width="1"> + <?php if($_['page']>0):?> + <span class="pagerbutton1"><a href="<?php echo $_['page']-1;?>">prev</a> </span> + <?php endif; ?> + </td> + <td> + <?php if ($_['pagestart']>0):?> + ... + <?php endif;?> + <?php for ($i=$_['pagestart']; $i < $_['pagestop'];$i++):?> + <?php if ($_['page']!=$i):?> + <a href="<?php echo $_['url'].$i;?>"><?php echo $i+1;?> </a> + <?php else:?> + <?php echo $i+1;?> + <?php endif?> + <?php endfor;?> + <?php if ($_['pagestop']<$_['pagecount']):?> + ... + <?php endif;?> + </td> + <td width="1"> + <?php if(($_['page']+1)<$_['pagecount']):?> + <span class="pagerbutton2"><a href="<?php echo $_['page']+1;?>">next</a></span> + <?php endif; ?> + </td> + </tr> + </table> +</center>
\ No newline at end of file |