a Sensio Labs Product

The flexible, fast, and secure
template engine for PHP

Functions » block

Questions & Feedback

License

Creative Commons License Twig documentation is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.

blockΒΆ

When a template uses inheritance and if you want to print a block multiple times, use the block function:

1
2
3
4
5
<title>{% block title %}{% endblock %}</title>

<h1>{{ block('title') }}</h1>

{% block body %}{% endblock %}

See also

extends, parent

This website is powered by PHP and Twig. The Twig logo is © 2010-2012 Sensio Labs