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.
Not sure if it can help, but I have written an adapter for models that extends the paginator select adapter. 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) -- Giorgio Sironi Piccolo Principe & Ossigeno Scripter http://www.sourceforge.net/projects/ossigeno
