snippet()
Embeds a snippet from the snippet folder
Parameters
Name | Type | Default |
---|---|---|
$name * | mixed |
– |
$data | mixed |
[ ] |
$return | bool |
false |
$slots | bool |
false |
Return type
Kirby\Template\Snippet
|string
|null
Example
Snippet alternatives
You can define an array of snippet alternatives if the first snippet cannot be found:
This is useful if you want to provide fallbacks for a snippet based on page input, in case the snippet does not exist: