Use a Zend_Db_Select object for your query and pass the instance to factory(). If that doesn't suit your needs for some reason, you can easily write your own adapter by implementing Zend_Paginator_Adapter_Interface or extending Zend_Paginator_Adapter_DbSelect. Hope that helps,
-Matt On Tue, Sep 30, 2008 at 8:13 AM, 411161 <[EMAIL PROTECTED]> wrote: > > Thanks. For some reason, I must have missed all that when I first looked at > the reference guide. > > So what I have done now is, changed my view to add the following: > <?= $this->paginationControl($this->paginator2, 'Sliding', 'p.phtml'); ?> > > And in the p.phtml I have added the code from > http://framework.zend.com/manual/en/zend.paginator.usage.html > under the heading: Item pagination > > What I am still unsure of is how I can not go to the db each time I click > one of my links(first, last). I can't seem to find that in the > documentation. Not sure if this is where sessions come in or what. But I > was > hoping to see an example. > > > > 411161 wrote: > > > > I have it working, but I am not sure how to create links for next, last, > > first, previous, numbers, etc.. I am also not sure how to handle links in > > my controller. > > This is what I have so far." > > > > controller: > > public function paginateAction() { > > > > $sql = 'SELECT * FROM runz_miles WHERE empl_no = 31713'; > > $this->view->result = $this->db->fetchAll($sql); > > $paginator = Zend_Paginator::factory($this->view->result); > > $paginator->setCurrentPageNumber(15); > > $this->view->paginator = $paginator; > > } > > > > in my view I have: > > <table> > > <? > > foreach($this->paginator as $key => $row){ > > > > echo "<tr><td>" .$row['EMPL_NO'] > . "</td>\n"; > > echo "<td>" .$row['PRISM_ORG_CODE'] > . "</td></tr>\n"; > > } > > ?> > > </table> > > > > How do I create the links and I how do I handle the action so that it > will > > not try and call the sql again? > > > > -- > View this message in context: > http://www.nabble.com/Looking-for-a-complete-Complete-Zend_Paginator-example-tp19731530p19744120.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >
