Skip to content

Kirby 4.4.1

$pages->paginate()

Add pagination and return a sliced set of data.

$pages->paginate(mixed ...$arguments = null): Kirby\Cms\Pages

Parameters

Name Type Default
... $arguments mixed null

Return type

Kirby\Cms\Pages

This method does not modify the existing $pages object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Cms\Pages inherited from Kirby\Cms\Collection

Examples

$arguments is an option array

$articles = $page->children()->paginate([
  'page'     => 1,
  'limit'    => 10,
  'total'    => 120,
  'method'   => 'query',
  'variable' => 'p'
]);

First argument is the limit

Show 10 items per page:

$articles = $page->children()->paginate(10);

First is the limit, second is the page

Show items 11-20:

$articles = $page->children()->paginate(10, 2);

First is the limit, second are options

$articles = $page->children()->paginate(10, […]);

Check out the docs for the $pagination object