Greetings!
I've run into a pagination issue that I can't resolve. It's permanently stuck at the first 4 items as defined in paginator limit, or page one. Page two shows the same records and won't let me go any further than that with the next button. Is there something wrong with my code?
In my TestController.php
I have the following:
public function indexAction()
{
$numberPage = 1;
$items = Items::find();
$paginator = new Paginator([
"data" => $items,
"limit" => 4,
"page" => $numberPage,
]);
$this->view->title = 'Test Index';
$this->view->items = $items;
$this->view->page = $paginator->getPaginate();
}
And in the corresonding volt view I have:
{% for item in page.items %}
{{ item.title }}
{% endfor %}
// further down
<li>{{ link_to("test", 'First') }}</li>
<li>{{ link_to("test?page=" ~ page.before, '← Previous') }}</li>
<li>{{ link_to("test?page=" ~ page.next, 'Next →') }}</li>
<li>{{ link_to("test?page=" ~ page.last, 'Last') }}</li>
Thank you