Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

Taking your approach on designing things actually makes it fun, more natural, and overall easier.

— Dominik, Developer

limit Modifier

Limits the number of items returned in an array.

playlist:
- Emancipator
- Gong Gong
- Possom Posse
- Justin Bieber

Use with the pipe syntax to continue chaining in a single tag like so:

{{ playlist | limit(2) | join }}
{{ Statamic::modify($playlist)->limit(2)->join() }}
Emancipator, Gong Gong

Or using the parameter syntax:

{{ playlist | limit(2) }}
<li>{{ value }}</li>
{{ /playlist }}
<?php
$limitedPlaylist = Statamic::modify($playlist)->limit(2);
?>
 
@foreach ($limitedPlaylist as $item)
<li>{{ $item }}</li>
@endforeach
<li>Emancipator</li>
<li>Gong Gong</li>
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →