\Ceo\PaginationPagination

Pagination accepts a pagination object generated by the Builder system to create a loopable set of objects you can include in a template.

$builder = $this->getDI()->getArticleManager()->getBuilder()
    ->setPage($page)
    ->setLimit($perPage)
    ->byTags($section->tags)
    ->paginate();

$articles = $builder->getItems();
$paginator = (new Pagination)
    ->setPagination($builder->getPagination())
    ->setLimit($perPage)
    ->build();

Then in your template

{% for page in paginator %}
 <a href="{{ page.url }}">{{ page.label }}</a>
{% endfor %}

Summary

Methods
Properties
Constants
__construct()
setShow()
setLimit()
setPagination()
setParams()
setUrl()
getFirst()
getLast()
getNext()
getPrevious()
getPages()
rebuild()
build()
getIterator()
jsonSerialize()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$pagination
$url
$show
$limit
$next
$previous
$first
$last
$pages
$params
$allLinks
$placeholders
$built
N/A

Properties

$pagination

$pagination : 

Type

$url

$url : 

Type

$show

$show : 

Type

$limit

$limit : 

Type

$next

$next : 

Type

$previous

$previous : 

Type

$first

$first : 

Type

$last

$last : 

Type

$pages

$pages : 

Type

$params

$params : 

Type

$allLinks

$allLinks : 

Type

$placeholders

$placeholders : 

Type

$built

$built : 

Type

Methods

__construct()

__construct(  $pagination = array(),   $url = false) 

Create new paginator If no url is provided, will use current.

Parameters

$pagination
$url

setShow()

setShow(integer  $pages) : self

Set number of pages to show for sliding pagination

Parameters

integer $pages

Returns

self

setLimit()

setLimit(  $limit) : self

Set the number of items per page

Parameters

$limit

Returns

self

setPagination()

setPagination(\Ceo\Pagination\stdClass  $pagination) : self

Set the pagination object

Parameters

\Ceo\Pagination\stdClass $pagination

Returns

self

setParams()

setParams(  $params = array()) : self

Set extra query params, note that reserved words will be unset

Parameters

$params

Returns

self

setUrl()

setUrl(  $url) : self

Set the base pagination URL. Will substitute page and per_page attributes

Parameters

$url

Returns

self

getFirst()

getFirst() : object

Get first page

Returns

object —

Ceo\Pagination\Url

getLast()

getLast() : object

Get last page

Returns

object —

Ceo\Pagination\Url

getNext()

getNext() : object

Get next page

Returns

object —

Ceo\Pagination\Url

getPrevious()

getPrevious() : object

Get previous page

Returns

object —

Ceo\Pagination\Url

getPages()

getPages() : array

Get all numbered pages, e.g. not first/last and next/previous

Returns

array —

of Ceo\Pagination\Url

rebuild()

rebuild() : self

Force a rebuild of pagination. Really only useful if you reset the pagination object or url options after building

Returns

self

build()

build() : self

Build pagination. Called automatically on first attempt to access pages

Returns

self

getIterator()

getIterator() : \Ceo\Pagination\ArrayIterator

Allow for iterator access

Returns

\Ceo\Pagination\ArrayIterator

jsonSerialize()

jsonSerialize() : Array

Allow for proper JSON serialization

Returns

Array