Partial If Exists Tag

Renders a partial if it exists.

Overview

You can use this tag to output a partial if it exists. Useful if you have some sort of dynamic loop.

{{ partial:if_exists src="mypartial" }}

Practically identical to the partial except if the view doesn’t exist it will just output nothing instead of throwing a “view not found” exception.

This tag goes hand in hand with the partial tag. You may be interested in the partial:exists tag if you need to do a more complicated conditional check in your template.

Parameters

src

string

You can pass the name of the partial with a parameter instead of tag argument. Example: src="cards/author_bio" or :src="var_name".

*

mixed

Any parameter you create will be passed through to the partial as a variable.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →