{% partial %}

October CMS Documentation Docs

{% partial %}

The {% partial %} tag will parse a CMS partial and render the partial contents on the page. To display a partial called footer.htm, simply pass the name after the partial tag quoted as a string.

___TWIG0___

A partial inside a subdirectory can be rendered in the same way.

___TWIG0___

Note: The Themes documentation has more details on subdirectory usage.

The partial name can also be a variable:

___TWIG0___
___TWIG1___

# Variables

You can pass variables to partials by specifying them after the partial name:

___TWIG0___

You can also assign new variables for use in the partial:

___TWIG0___

Inside the partial, variables can be accessed like any other markup variable:

<p>Country: ___TWIG0___, city: ___TWIG1___.</p>

# Checking a partial exists

In any template you can check if a partial content exists by using the partial() function. This lets you to generate different markup depending on whether the partial exists or not. Example:

___TWIG0___

___TWIG1___
    ___TWIG2___
___TWIG3___
    <p>Card not found!</p>
___TWIG4___