David Noreña David Noreña - 13 days ago 4x
PHP Question

How to Return resultset by pages zend framework 2

I'm a newbie in Zend framework 2

Hi every body I was following the this tutorial of zend framework using Skeleton App http://framework.zend.com/manual/2.0/en/user-guide/skeleton-application.html

I finished, but now I got a question If I have thousands and thousands of rows in Album Table
How to retrieve them by pages ?

I see something called paginator I don't know if that's the right way ....

I'd appreciate if you post the way to use it or some code ....

Thank you in advance
Sorry for my bad english ...


Look into Zend_Paginator It does pretty much exactly what you want.

From the manual:

$adapter = new Zend_Paginator_Adapter_DbSelect($db->select()->from('posts'));
               Zend_Paginator_Adapter_DbSelect::ROW_COUNT_COLUMN => 'post_count'

$paginator = new Zend_Paginator($adapter);

I would recommend looking into a tutorial about this