Try not to pass the total $result array. Let paginator execute the query.

       $paginator = Zend_Paginator::factory($select);
       $paginator->setItemCountPerPage(10);
       $paginator->setCurrentPageNumber($page);
       $paginator->setPageRange(10);
       $paginator->setDefaultScrollingStyle('Sliding');

Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml');
       $this->view->pages = $paginator->getPages();

This case you only query for the element needing (limit,offset).

When linking make certain that you catch the selected like
$page = $this->_request->getParam('page')

Works fine for me

vladimirn schrieb:
I have a problem with zend pagination.
In my controller i have this:
                $result = $db->fetchAll ( $sql );
                $page = $this->_getParam ( 'page', 1 );
                $paginator = Zend_Paginator::factory ( $result );
                $paginator->setItemCountPerPage ( 2 );
                $paginator->setCurrentPageNumber ( $page );
                $paginator->setPageRange ( 5 );
                Zend_View_Helper_PaginationControl::setDefaultViewPartial (
'paginator.phtml' );
                $this->view->paginator = $paginator;

Now in my view file i am getting this:
Start | < Previous | 1 2  3  | Next > |  End   Page 1 of 3

Page 2 and 3 and Next are links, but when i click on them, my browser
reload, but same result is display on the page. Actually i am not getting
result for page 2, 3 or next. Same result as for page 1 is displayed. How to
fix this?

Thanks,
V

--- Begin Message ---
I have a problem with zend pagination.
In my controller i have this:
                $result = $db->fetchAll ( $sql );
                $page = $this->_getParam ( 'page', 1 );
                $paginator = Zend_Paginator::factory ( $result );
                $paginator->setItemCountPerPage ( 2 );
                $paginator->setCurrentPageNumber ( $page );
                $paginator->setPageRange ( 5 );
                Zend_View_Helper_PaginationControl::setDefaultViewPartial (
'paginator.phtml' );
                $this->view->paginator = $paginator;

Now in my view file i am getting this:
Start | < Previous | 1 2  3  | Next > |  End   Page 1 of 3

Page 2 and 3 and Next are links, but when i click on them, my browser
reload, but same result is display on the page. Actually i am not getting
result for page 2, 3 or next. Same result as for page 1 is displayed. How to
fix this?

Thanks,
V
-- 
View this message in context: 
http://www.nabble.com/Question-about-zend-pagination-tp20543032p20543032.html
Sent from the Zend Framework mailing list archive at Nabble.com.


--- End Message ---

Reply via email to