Advertisement
TheFan1968

ZF3. Pagination Simple Page Navigation

Apr 7th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2. if(isset($this->previous)):
  3.     $prevUrl = $this->url($this->route,['page' => $this->previous]);
  4. endif;
  5. if(isset($this->next)):
  6.     $nextUrl = $this->url($this->route,['page' => $this->next]);
  7. endif;
  8. if($this->pageCount):
  9.  
  10. ?>
  11. <ul class="pagination">
  12.     <?php if(isset($prevUrl)):?>
  13.         <li><a href="<?= $prevUrl ?>">&laquo;</a></li>
  14.     <?php else:?>
  15.         <li class="disabled"><a>&laquo;</a></li>
  16.     <?php endif;?>
  17.     <?php foreach($this->pagesInRange as $page):
  18.            $actUrl = $this->url($this->route,['page' => $page]);
  19.            if($page != $this->current): ?>
  20.             <li><a href="<?= $actUrl ?>"><?= $page ?></a></li>
  21.            <?php else:?>
  22.             <li class="active"><a><?= $page ?></a></li>
  23.            <?php endif;?>  
  24.     <?php endforeach;
  25.        if(isset($nextUrl)):
  26.     ?>
  27.         <li><a href="<?= $nextUrl ?>">&raquo;</a></li>
  28.     <?php else:?>
  29.         <li class="disabled"><a>&raquo;</a></li>
  30.     <?php endif;?>
  31. </ul>
  32. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement