Código PHP:
Fatal error: Uncaught exception 'Zend_Controller_Router_Exception' with message Cannot assemble. Reversed route is not specified.
Para instalar el paginator hice lo siguiente:
Controlador:
Código PHP:
public function listadoAction()
{
// Set pagination settings
$page = $this->_getParam('page', 1);
$itemCountPerPage = 10;
$pageRange = 10;
// Get data
$user_model = new User();
$users = $user_model->fetchAll()->toArray();
// Create paginator
$paginator = Zend_Paginator::factory($users);
$paginator->setItemCountPerPage($itemCountPerPage)
->setCurrentPageNumber($page)
->setPageRange($pageRange);
// Create paginator control partial view
Zend_View_Helper_PaginationControl::setDefaultViewPartial('libreria/_partials/search_pagination_control.phtml');
// Assign paginator to view
$this->view->paginator = $paginator;
}
Código PHP:
class User extends Zend_Db_Table
{
protected $_name = 'users';
protected $_primary = 'id';
}
Código PHP:
<h1>Users</h1>
<?php if (count($this->paginator)) { ?>
<?php foreach ($this->paginator as $item) { ?>
<?php echo $item['nombre']; ?><br />
<?php } ?>
<?php } ?>
<br />
<?php echo $this->paginationControl($this->paginator); ?>
Código PHP:
<?php if ($this->pageCount): ?>
<div id="paginationControl">
<!-- Previous page link -->
<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->previous)); ?>">< Previous</a> |
<?php else: ?>
<span class="disabled">< Previous</span> |
<?php endif; ?>
<!-- Numbered page links -->
<?php foreach ($this->pagesInRange as $page): ?>
<?php if ($page != $this->current): ?>
<a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> |
<?php else: ?>
<?= $page; ?> |
<?php endif; ?>
<?php endforeach; ?>
<!-- Next page link -->
<?php if (isset($this->next)): ?>
<a href="<?= $this->url(array('page' => $this->next)); ?>">Next ></a>
<?php else: ?>
<span class="disabled">Next ></span>
<?php endif; ?>
</div>
<?php endif; ?>
Código PHP:
$router->addRoute ( 'libreria-listado', new Zend_Controller_Router_Route_Regex ( 'administracion/libreria/listado/(\d+)', array ('module' => 'administracion', 'controller' => 'libreria', 'action' => 'listado' ), array (1 => 'page' ) ) );
La verdad no entiendo por que es.
Alguna idea?
Desde ya, muchas gracias.