http://symfony.com/doc/current/book/page_creation.html
1 2 3 4 5 6
{# src/Acme/HelloBundle/Resources/views/Hello/index.html.twig #} {% extends '::base.html.twig' %} {% block body %} Hello {{ name }}! {% endblock %}
- line 2: The
extendstoken defines a parent template. The template explicitly defines a layout file inside of which it will be placed. - line 4: The
blocktoken says that everything inside should be placed inside a block calledbody. As you'll see, it's the responsibility of the parent template (base.html.twig) to ultimately render the block calledbody.
::base.html.twig, is missing both the BundleName
and ControllerName portions of its name (hence the double colon (::)
at the beginning). This means that the template lives outside of the bundles
and in the app directory
沒有留言:
張貼留言