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