Giorgio Sironi wrote:
>
> 2008/8/5 Axel Wüstemann <[EMAIL PROTECTED]>:
>> I'm a bit confused, how to integrate Zend_Paginate into my app framework.
>> In
>> order to use the DbSelect adapter, I need a select object, which is in my
>> model. In order to display the page numbers I need the view object which
>> I
>> have in the controller.
>
> http://ossigeno.svn.sourceforge.net/viewvc/ossigeno/trunk/core/library/Otk/Paginator/Adapter/Model.php?view=markup
>
> Now in models I do something like:
> public function prepareArticles($page)
> {
> [...]
> $select = $table->select()
> ->from($table, array('id'))
> ->where('section = ?', $this->_row->id)
> ->order('date '. $this->_row->view_order);
>
> $paginator = new Zend_Paginator(
> new Otk_Paginator_Adapter_Model($select,
> 'Otk_Content_Article'));
> $paginator->setItemCountPerPage((int) $this->_row->view_limit);
> $paginator->setCurrentPageNumber($page);
> return $paginator;
> }
>
> Otk_Content_Article is the classname of the model.
> (note that the adapter returns arrays of structures (associative
> array) calling prepare() of models, an extension of toArray(), but
> with little editing can return the object themselves)
>
>
Yes, it seems to me a good idea to let reside the paginator in the model.
What happens in the controller? How the view comes into play?
--
View this message in context:
http://www.nabble.com/Zend_Paginate-how-to-integrate--tp18835208p18836255.html
Sent from the Zend Framework mailing list archive at Nabble.com.