Symfony Templates Cookbook: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(Created page with "Category:Symfony Category:PHP Category:Web Development == Template tags == `<nowiki>{{ ... }}</nowiki>` enclose variables. Object properties are referenced with ...")
 
mNo edit summary
Line 18: Line 18:


`{# ... #}` encloses comments.<ref>[http://symfony.com/doc/current/book/templating.html Creating and Using Templates], Symfony documentation</ref>
`{# ... #}` encloses comments.<ref>[http://symfony.com/doc/current/book/templating.html Creating and Using Templates], Symfony documentation</ref>


== Headers and footers ==
== Headers and footers ==

Revision as of 16:24, 25 January 2015


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