Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $db->select()->from(array('t'=> 'table_name'));
- $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
- $paginator->setItemCountPerPage(20)
- ->setCurrentPageNumber($this->_getParam('page', 1))
- ->setPageRange(10);
- $this->view->paginator = $paginator;
- ?>
- // Controller View
- <?php foreach($this->paginator as $item): ?>
- <?= $this->paginationControl($this->paginator, 'Sliding', 'partials/paginator.phtml'); ?>
- // paginator view helper
- <?php
- if ($this->pageCount > 1)
- $this->previous
- foreach ($this->pagesInRange as $page) {
- if ($page != $this->current)
- echo 'link';
- else
- echo 'text';
- }
- $this->next
- }
Advertisement
Add Comment
Please, Sign In to add comment