Symfony Templates Cookbook

From Littledamien Wiki
Revision as of 16:24, 25 January 2015 by Video8 (talk | contribs)
Jump to navigation Jump to search


Template tags

`{{ ... }} enclose variables. Object properties are referenced with dot notation: {{obj.prop}}. Functions can be put in tags too.

Filters can be applied with the pipe character: {{ title|upper }}.

{% ... %}` encloses logic.

<ul id="navigation">
            {% for item in navigation %}
                <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
            {% endfor %}
        </ul>

{# ... #} encloses comments.[1]

Headers and footers

Notes

  1. Creating and Using Templates, Symfony documentation