Pagination in zend framework

public function indexAction() {
$data = $this->_em->getRepository('Application_Model_User')
->findBy(array('isDelete' => 0, 'roleId' => 2));
/* Pagination */
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($data);
$paginator->setItemCountPerPage(8);
$paginator->setCurrentPageNumber($page);
$paginator->setPageRange(1);
$this->view->homeData = $paginator;
}

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *