$pages->paginate($limit, $options = array())

Adds a $pagination object to the collection, which makes it easy to page through items

  • $limit (int)
    Number of items per page
  • $options (array)
    See below
  • return ($pages)

Example

Show 10 items per page:

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

Options:

variable: default: "page".

Change the name of the parameter variable, e.g. in a multi-lingual site. The following example will result in /seite:n for the German site and /page:n for the rest.

$articles = $page->children()->paginate(20, array( 'variable' => $site->language()->code() == 'de' ? 'seite' : 'page' ));

method: default: "param"

omitFirstPage: default: true

page: default: false

url: default: null

Check out the docs for the $pagination object


Is something missing or incorrect? Edit this page on Github…