Navigation panel


/ Published in: PHP
Save to your folder(s)

Navigation panel


Copy this code and paste it in your HTML
  1.  
  2. for ($i=0; $i<$pages; $i++) {
  3. if ($i+1==$current_page)
  4. echo '<span>'.($i+1).'</span>';
  5. else
  6. echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.($i+1).'">'.($i+1).'</a>';
  7. }
  8.  
  9. $nav = ob_get_clean();
  10.  
  11. $nav = str_replace('<a',str_repeat('&',3).'<a', $nav);
  12. $nav = str_replace('<s',str_repeat('&',3).'<s', $nav);
  13. $nav = explode('&&&',$nav);
  14. $nav = array_chunk($nav, 30);
  15.  
  16.  
  17. foreach ($nav as $key=>$chunk) {
  18. $nav[$key] = implode(str_repeat('&nbsp;',3), $chunk);
  19. }
  20. $nav = implode('<br/>',$nav);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.