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);
}
--- /dev/null
+<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