Controlador
Código PHP:
Ver originalpublic function indexAction()
{
$data = $this->albumTable->fetchAll();
$view = new PhpRenderer();
$view->resolver()->addPath(__DIR__ . '/../../../views/paginator');
PaginationControl::setDefaultViewPartial('items.phtml');
$paginator = Paginator::factory($data);
$paginator->setDefaultItemCountPerPage(5);
$paginator->setView($view);
$paginator->setCurrentPageNumber($this->request->query()->get('page', 1));
'albums' => $paginator
);
}
la vista:
Código PHP:
Ver original<?php if ($this->pageCount): ?>
<div class="paginationControl">
<?php echo $this->firstItemNumber; ?> - <?php echo $this->lastItemNumber; ?>
of <?php echo $this->totalItemCount; ?>
<!-- First page link -->
<?php if (isset($this->previous)): ?> <a href="
<?php echo $this->url('default', array('page' => $this->first)); ?>">
First
</a> |
<?php else: ?>
<span class="disabled">First</span> |
<?php endif; ?>
<!-- Previous page link -->
<?php if (isset($this->previous)): ?> <a href="
<?php echo $this->url('default', array('page' => $this->previous)); ?>">
< Previous
</a> |
<?php else: ?>
<span class="disabled">< Previous</span> |
<?php endif; ?>
<!-- Next page link -->
<a href="
<?php echo $this->url('default', array('page' => $this->next)); ?>">
Next >
</a> |
<?php else: ?>
<span class="disabled">Next ></span> |
<?php endif; ?>
<!-- Last page link -->
<a href="
<?php echo $this->url('default', array('page' => $this->last)); ?>">
Last
</a>
<?php else: ?>
<span class="disabled">Last</span>
<?php endif; ?>
</div>
<?php endif; ?>
Edit: Todo el problema debe ser relacionado con esto:
Cita: Warning: No RouteStack instance provided
Y en lo demás ya no le hice cambios (es lo mismo del tutorial), quedó sin mostrar enlaces.