In your link to the next or whatever resultpage site:
Are you sure that param page is there?
Try something like
Zend_Debug::dump($this->_request->getParams())
You should see page = something
In my paginator template I link to
/baseUrl/module/controller/page/2
/baseUrl/module/controller/2 would not work.
Another way to debug or to find the failure is to set:
$paginator->setCurrentPageNumber(2);
Do you see the expected results from page 2?
If so, than you definitly do not pass param page with value 2.
vladimirn schrieb:
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 -->
< Previous |
<!-- Numbered page links -->
1 |
/display/2/CL/3 2 |
<!-- Next page link -->
/display/2/CL/3 Next >
</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)); ?>">< Previous |
<?php else: ?>
< 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 >
<?php else: ?>
Next >
<?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