Hi all.
I'm having a bit of a problem trying to get the pagination working using a
route. It is not printing the page numbers in the a href of the urls. so it
just goes to wedding/bouquets/category instead of
wedding/bouquets/category/2 etc
The pagination shows, but I do not get the correct links.
they just point to the base page. And when i go to
wedding/bouquets/category/2 etc if shows the correct page too. So all is
working except the links, which show, but don't function correctly.
Also is it possible to link the number 1 link back so it doesnt have the 1
there. ie the base page?
wedding/bouquets/category and have page 2 go to wedding/bouquets/category/2
etc
in my bootstrap i have these routes set already
$route = new Zend_Controller_Router_Route(
'wedding/bouquets/:bouquet',
array(
'controller' => 'wedding',
'action' => 'bouquet'
)
);
$router->addRoute('bouquet',$route2);
$route3 = new Zend_Controller_Router_Route(
'wedding/bouquets/:bouquet/:page',
array(
'controller' => 'wedding',
'action' => 'bouquet'
)
);
in the wedding controller, bouquet action i have the following
$bouquet = new Bouquet();
if ($category_id > 0) {
$obj = $bouquet->fetchAll('bouquet_category='.$category_id);
$array = $obj->toArray();
$this->view->paginator = Zend_Paginator::factory($array);
$this->view->paginator->setCurrentPageNumber($this->_getParam('page'));
$this->view->bouquet = $bouquet->fetchAll('bouquet_category='.$category_id);
return;
}
then in my view i have
<?php if (count($this->paginator)): ?><?=
$this->paginationControl($this->paginator,
'Sliding',
'my_pagination_control.phtml'); ?>
<ul >
<?php echo $this->partialLoop('partials/_bouquets.phtml', $this->paginator);
?>
</ul>
<?= $this->paginationControl($this->paginator,
'Sliding',
'my_pagination_control.phtml'); ?>
<?php endif; ?>
and the my_pagination_control.phtml looks like this
<?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; ?>
thanks for any help given. It is always much appreciated.
--
View this message in context:
http://www.nabble.com/Pagination-with-routes-not-working.-tp20657017p20657017.html
Sent from the Zend Framework mailing list archive at Nabble.com.