Pagination Helper

Is there any Pagination Helper?

Something Like: < 1 ... 12 13 [14] 15 16 ... 63 >

Not exactly what im looking for.

edited Apr '16

Hey, I don't know if this could help : https://github.com/Zheness/Pagination, it's an old project. The documentation is not in english (sorry), but I give code examples.

I didn't tested but this could work for you :

// [...]
$maxElements = 20;
$paginator = new \Phalcon\Paginator\Adapter\Model([
    "data"  => Albums::find(),
    "limit" => $maxElements,
    "page"  => (int) $this->request->getQuery('page', 'int'),
]);
$albumsPaginator = $paginator->getPaginate();

if ($albumsPaginator->total_pages > 1) {
    $pagination = new Pagination(); // here is my class
    $pagination->setCurrentPage($albumsPaginator->current);
    $pagination->setNbElementsInPage($maxElements);
    $pagination->setNbMaxElements($albumsPaginator->total_items);
    $pagination->setUrl("/album/page/{i}");
    $this->view->pagination = $pagination->renderBootstrapPagination();
}
$this->view->albumsPaginator = $albumsPaginator;
// [...]

$pagination will contains the HTML pagination as you want, and $albumsPaginator the Phalcon paginator.

The class render with bootstrap, but you can override it.

Hi.. I just did one myself.. I works just fine.. I don't know if you solved your issue yet.. but if not take look here:

https://gist.github.com/arthurgermano/b612050b473dfd17076e8f63749d9c89

I hope it helps...

cheers.