Well, this is embarrassing. It's a bug that I apparently introduced in
1.6.1. Please file a ticket and I'll try to fix it within 12 hours. In the
meantime, you can resolve this by naming your paginator object something
besides $paginator; $paginator1 will work.
-Matt
On Thu, Sep 18, 2008 at 12:11 AM, chrisweb <[EMAIL PROTECTED]>wrote:
>
> Hello,
>
> I have downloaded the new zend framework 1.6.1. I love it but I'm new and
> only use it since few weeks, i have a first question regarding the
> pagination:
>
> I have a view in my administration which shows me my news articles, there
> two lists one which shows the last ten active news another one which shows
> the last 10 inactive articles.
>
> If a publish two articles, the first paginator shows the two articles, but
> the second paginator also shows me that 2 articles were found but lists
> none, this is not true there are two active articles but no inactive
> article, i don't understand why the scond paginator shows me that two
> articles were found..?
>
> can somebody help me? ;)
>
> heres my source:
>
> indexAction:
>
> // active articles listing
> $db = Zend_Registry::get('db');
> $db->setFetchMode(Zend_Db::FETCH_ASSOC);
>
> $articlesTable = new Articles();
> $alist = $articlesTable->outputactive();
>
> $paginator =
> Zend_Paginator::factory($alist);
>
> $pageNumber =
> (int)$this->_request->getParam('page', 1);
>
> $partial =
> '_partials/paginationControl.phtml';
>
>
> Zend_View_Helper_PaginationControl::setDefaultViewPartial($partial);
>
> $paginator ->setItemCountPerPage(10)
> ->setPageRange(5)
>
> ->setCurrentPageNumber($pageNumber);
>
> $this->view->paginator = $paginator;
>
> // INactive lists listing
> $alist2 = $articlesTable->outputinactive();
>
> $paginator2 =
> Zend_Paginator::factory($alist2);
>
>
> Zend_View_Helper_PaginationControl::setDefaultViewPartial($partial);
>
> $paginator2 ->setItemCountPerPage(10)
> ->setPageRange(5)
>
> ->setCurrentPageNumber($pageNumber);
>
> $this->view->paginator2 = $paginator2;
>
> articles model:
>
> public function outputactive() {
>
> // list all active articles
> $articlesTable = new Articles();
> $query = "SELECT id, title FROM articles WHERE active=1
> ORDER BY id";
> $db = $articlesTable->getAdapter();
> $result = $db->query($query);
> return $result->fetchAll();
>
> }
>
> public function outputinactive() {
>
> // list all inactive lists
> $articlesTable = new Articles();
> $query = "SELECT id, title FROM articles WHERE active=0
> ORDER BY id";
> $db = $articlesTable->getAdapter();
> $result = $db->query($query);
> return $result->fetchAll();
>
> }
>
> articles index view:
>
> if (count($this->paginator)) {
>
> foreach ($this->paginator as $list) {
> echo $list['title'].'<br />'
> }
>
> echo '<br /><br />';
> echo $this->paginationControl($this->paginator);
>
> echo '<br /><br />';
>
> }
>
> if (count($this->paginator2)) {
>
> foreach ($this->paginator2 as $list2) {
> echo $list2['title'].'<br />'
> }
>
> echo '<br /><br />';
> echo $this->paginationControl($this->paginator2);
>
> echo '<br /><br />';
>
> }
>
> pagination partial:
>
> if ($this->pageCount) {
>
> echo 'Articles '.$this->firstItemNumber.' -
> '.$this->lastItemNumber.' de
> '.$this->totalItemCount;
>
> echo '<br />';
>
> echo ' "'.$this- url(array('page' => $this->first)).'">First | ';
>
>
> if (isset($this->previous)) {
>
> echo ' "'.$this- url(array('page' =>
> $this->previous)).'">< Previous
> | ';
>
> } else {
>
> echo '< Previous | ';
>
> }
>
> foreach ($this->pagesInRange as $page) {
>
> if ($page != $this->current) {
>
> echo ' "'.$this- url(array('page' =>
> $page)).'">'.$page.' | ';
>
> } else {
>
> echo $page.' | ';
>
> }
> }
>
> if (isset($this->next)) {
>
> echo ' "'.$this- url(array('page' => $this->next)).'">Next
> > | ';
>
> } else {
>
> echo 'Next > | ';
>
> }
>
> echo ' "'.$this- url(array('page' => $this->last)).'">Last ';
>
> }
> --
> View this message in context:
> http://www.nabble.com/2-paginator-in-same-view-tp19547285p19547285.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>