catcompose

See also

compose, catinclude and block.

Compose another template based on the category of a resource.

The catcompose tag is the category-aware variant of compose. It selects the template using category lookup, like catinclude, and also lets the caller override named blocks in the selected template.

Example:

{% catcompose "_teaser.tpl" id %}
    {% block body %}
        <p>Custom teaser body</p>
    {% endblock %}
{% endcompose %}

The selected template depends on the category hierarchy of id, using the same lookup rules as catinclude.

Arguments

Extra arguments can be passed to the composed template:

{% catcompose "_teaser.tpl" id title="Summary" %}
    {% block body %}Custom teaser body{% endblock %}
{% endcompose %}

The with keyword is optional here as well:

{% catcompose "_teaser.tpl" id with title="Summary" %}
    {% block body %}Custom teaser body{% endblock %}
{% endcompose %}

The resource id is also available in the composed template as id.