Skip to content

Kirby 5.0.4

$pages->nth()

Returns the nth element from the collection

$pages->nth(int $n): Kirby\Cms\Page|null

Parameters

Name Type Default
$nrequired int no default value

Return types

Kirby\Cms\Pageornull

This method modifies the existing $pages object it is applied to and returns it again.

Parent class

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

Examples

// echo the title of the 4th subpage
// (the index starts at 0)
echo $page->children()->nth(3)->title();