$pages->limit()
Returns a new object with a limited number of elements
$pages->limit(int $limit): Kirby\Toolkit\Collection
Parameters
Name | Type | Default | Description |
---|---|---|---|
$limit |
int |
– | The number of elements to return |
Return type
Example
<h2>Latest subpages</h2>
<ul>
<?php foreach($page->children()->limit(3) as $subpage): ?>
<li>
<a href="<?= $subpage->url() ?>">
<?= html($subpage->title()) ?>
</a>
</li>
<?php endforeach ?>
</ul>
Inherited from
Kirby\Toolkit\Collection