>From the documentation:
The following is an example route you might use in an INI configuration
file:

routes.example.route = articles/:articleName/:page
routes.example.defaults.controller = articles
routes.example.defaults.action = view
routes.example.defaults.page = 1
routes.example.reqs.articleName = \w+
routes.example.reqs.page = \d+

With the above route (and using Zend Framework MVC components), you might
set the current page number like this:

$paginator->setCurrentPageNumber($this->_getParam('page'));

http://framework.zend.com/manual/en/zend.paginator.usage.html

-Matt

On Tue, Nov 18, 2008 at 1:50 PM, vladimirn <[EMAIL PROTECTED]> wrote:

>
> I have this in my route:
> $route = new Zend_Controller_Router_Route(
>    'display/:pid/:wid/:type',
>    array(
>        'controller' => 'banners',
>        'action'     => 'display'
>    )
> );
>
> $router->addRoute('display', $route);
>
> Matthew Ratzloff wrote:
> >
> > Do you define a "page" parameter in your route?
> > -Matt
> >
> > On Tue, Nov 18, 2008 at 10:14 AM, vladimirn <[EMAIL PROTECTED]>
> wrote:
> >
> >>
> >> Thank you Daniel,
> >> This is my view script:
> >> <?php if (count($this->paginator)): ?>
> >>
> >> <?php foreach ($this->paginator as $banner): ?>
> >>  <div>
> >> <div style="float:left; padding-left:20px"> "<?php echo
> >> $banner['bannerurl']
> >> ? "></div>
> >> </div>
> >> <?php endforeach; ?>
> >>
> >>
> >> <?php endif; ?>
> >> On the page i am getting expected amount of results.
> >>
> >> Then in my controller:
> >> $db = Zend_Registry::get ( 'db' );
> >>                                $select = $db->select ()
> >>                                ->from ( 'banners', array ('bannerurl',
> >> 'height', 'width', 'bannersize'
> >> ) )
> >>                                ->where ( 'active = ?', 'y' )
> >>                                ->where ('programid = ?', $programid)
> >>                                ->where('websiteid = ?', $websiteid)
> >>                                ->where('bannertype = ?', $bannertype)
> >>
> >>                                ->order ( 'height', 'ASC' );
> >>        $paginator = Zend_Paginator::factory($select);
> >>
> >>         // Set parameters for paginator
> >>        $paginator->setCurrentPageNumber($this->_getParam("page"));
> >>        $paginator->setItemCountPerPage(3);
> >>        $paginator->setPageRange(5);
> >>        $this->view->paginator = $paginator;
> >>
> >> And i am getting this on the page:
> >>  < Previous |  1 | 2 |  Next >
> >> ( there are 3 pictures, as expected)
> >>
> >> And finnaly there is a links produced:
> >> <div class="paginationControl">
> >> <!-- Previous page link -->
> >>
> >>  &lt; Previous |
> >>
> >>
> >> <!-- Numbered page links -->
> >>
> >>      1 |
> >>
> >>       /display/2/CL/3 2  |
> >>
> >> <!-- Next page link -->
> >>
> >>   /display/2/CL/3 Next &gt;
> >>
> >> </div>
> >>
> >> Above code for links i am getting via paginator.phtml
> >> It looks like:
> >> <?php if ($this->pageCount): ?>
> >> <div class="paginationControl">
> >> <!-- Previous page link -->
> >> <?php if (isset($this->previous)): ?>
> >>   "<?= $this- url(array('page' => $this->previous)); ?>">&lt; Previous
>  |
> >> <?php else: ?>
> >>  &lt; Previous |
> >> <?php endif; ?>
> >>
> >> <!-- Numbered page links -->
> >> <?php foreach ($this->pagesInRange as $page): ?>
> >>  <?php if ($page != $this->current): ?>
> >>     "<?= $this- url(array('page' => $page)); ?>"><?= $page; ?>  |
> >>  <?php else: ?>
> >>    <?= $page; ?> |
> >>  <?php endif; ?>
> >> <?php endforeach; ?>
> >>
> >> <!-- Next page link -->
> >> <?php if (isset($this->next)): ?>
> >>   "<?= $this- url(array('page' => $this->next)); ?>">Next &gt;
> >> <?php else: ?>
> >>  Next &gt;
> >> <?php endif; ?>
> >> </div>
> >> <?php endif; ?>
> >>
> >>
> >> So, finnal thouth :)
> >> I am getting number of results as expectede, and i am getting pagination
> >> div, as expected, but when i click on Next, or on 2(which is a link) i
> am
> >> not navigated to the next page, same page just reload, and shows same
> >> pictures. Also, links( 1,2,Next,Previous) dont change as visited or
> >> something if you know what i mean.
> >>
> >> Thanks a lot,
> >> V
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Question-about-zend-pagination-tp20543032p20565246.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Question-about-zend-pagination-tp20543032p20569014.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to