Can you provide a link?
I am not using Zend_View but a smarty solution.
When you dump $paginator, do you have the correct results? So only the
necessary amount of rows?
Are you sure $page is filled?
Kinda like:
$page = 1;
if($this->_getParam('page ')){
$page = $this->_getParam('page ');
}
I am using it with success:
$this->view->pages = $paginator->getPages(); (for the paginator.tpl,
like $this->pages->pageCount ->pagesInRange....
and
$this->view->results = $paginator (for looping the results)
My paginator.tpl looks like this, maybe it can help (remember this is
smarty):
{if $this->pages->pageCount > 1}
<div class="paginationControl">
{assign var=url value=$url|rtrim:"/"}
<!-- Last page link -->
{assign var=first value=$this->pages->first}
{assign var=last value=$this->pages->last}
{if !$this->pages->pagesInRange[$first]}
<a
href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->first}"
><<</a>
{/if}
{if $this->pages->pageCount > 6}
<!-- Previous page link -->
{if $this->pages->previous }
<a
href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->previous}"
>< Zurück</a> |
{/if}
{/if}
<!-- Numbered page links -->
{foreach from=$this->pages->pagesInRange key=myId item=i}
{if $i != $this->pages->current }
{assign var=j value=/seite/$i}
<a href="{$url|regex_replace:'/\/seite\/\d+/':''}{$j}" >{$i}</a>
{else}
<strong>{$i}</strong>
{/if}
{if $this->pages->last != $i} | {/if}
{/foreach}
{if $this->pages->pageCount > 6}
<!-- Next page link -->
{if $this->pages->next}
<a
href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->next}"
>Weiter ></a>
{/if}
{/if}
<!-- Last page link -->
{if !$this->pages->pagesInRange[$last]}
<a
href="{$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this->pages->last}"
>>></a>
{/if}
</div>
{/if}
vladimirn schrieb:
Thank you for swift replay :)
Now i went with this:
$page = $this->_request->getParam('page') ;
$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);
$paginator->setItemCountPerPage(3);
$paginator->setCurrentPageNumber($page);
$paginator->setPageRange(3);
$paginator->setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml');
$this->view->paginator = $paginator;
Still cant get proper results. Links are clickable, but not lead to next
page.
In display.phtml i have:
<?php echo $this->paginator ?>
<?php foreach ( $this->paginator as $banner ) :?>
<div>
<div style="float:left; padding-left:20px"> "<?php echo $banner['bannerurl']
? "></div>
</div>
<?php endforeach; ?>
Any suggestion?
Thanks
V