@@ -177,7 +177,7 @@ First, build a base layout file:
177
177
178
178
.. code-block :: html+jinja
179
179
180
- {# app/views/layout .html.twig #}
180
+ {# app/views/base .html.twig #}
181
181
<!DOCTYPE html>
182
182
<html>
183
183
<head>
@@ -202,7 +202,7 @@ First, build a base layout file:
202
202
203
203
.. code-block :: php
204
204
205
- <!-- app/views/layout .html.php -->
205
+ <!-- app/views/base .html.php -->
206
206
<!DOCTYPE html>
207
207
<html >
208
208
<head >
@@ -246,7 +246,7 @@ A child template might look like this:
246
246
.. code-block :: html+jinja
247
247
248
248
{# src/Sensio/BlogBundle/Resources/views/Blog/index.html.twig #}
249
- {% extends '::layout .html.twig' %}
249
+ {% extends '::base .html.twig' %}
250
250
251
251
{% block title %}My cool blog posts{% endblock %}
252
252
@@ -260,7 +260,7 @@ A child template might look like this:
260
260
.. code-block :: php
261
261
262
262
<!-- src/Sensio/BlogBundle/Resources/views/Blog/index.html.php -->
263
- <?php $view->extend('::layout .html.php') ?>
263
+ <?php $view->extend('::base .html.php') ?>
264
264
265
265
<?php $view['slots']->set('title', 'My cool blog posts') ?>
266
266
@@ -273,7 +273,7 @@ A child template might look like this:
273
273
274
274
.. note ::
275
275
276
- The parent template is identified by a special string syntax (``::layout .html.twig ``)
276
+ The parent template is identified by a special string syntax (``::base .html.twig ``)
277
277
that indicates that the template lives in the ``app/views `` directory
278
278
of the project. This naming convention is explained fully in
279
279
:ref: `template-naming-locations `.
@@ -390,7 +390,7 @@ lives in a specific location:
390
390
(``layout.html.twig ``) lives simply in the ``Resources/views `` directory
391
391
of the ``BlogBundle ``.
392
392
393
- * ``::layout .html.twig ``: This syntax refers to an application-wide base template
393
+ * ``::base .html.twig ``: This syntax refers to an application-wide base template
394
394
or layout. Notice that the string begins with two colons (``:: ``), meaning
395
395
that both the *bundle * and *controller * portions are missing. This means
396
396
that the template is not located in any bundle, but instead in the root
@@ -604,7 +604,7 @@ syntax for controllers (i.e. **bundle**:**controller**:**action**):
604
604
605
605
.. code-block :: html+jinja
606
606
607
- {# app/views/layout .html.twig #}
607
+ {# app/views/base .html.twig #}
608
608
...
609
609
610
610
<div id="sidebar">
@@ -613,7 +613,7 @@ syntax for controllers (i.e. **bundle**:**controller**:**action**):
613
613
614
614
.. code-block :: php
615
615
616
- <!-- app/views/layout .html.php -->
616
+ <!-- app/views/base .html.php -->
617
617
...
618
618
619
619
<div id =" sidebar" >
@@ -916,9 +916,9 @@ One common way to use inheritance is to use a three-level approach. This
916
916
method works perfectly with the three different types of templates we've just
917
917
covered:
918
918
919
- * Create a ``app/views/layout .html.twig `` file that contains the main layout
919
+ * Create a ``app/views/base .html.twig `` file that contains the main layout
920
920
for your application (like in the previous example). Internally, this template
921
- is called ``::layout .html.twig ``;
921
+ is called ``::base .html.twig ``;
922
922
923
923
* Create a template for each "section" of your site. For example, a ``BlogBundle ``,
924
924
would have a template called ``BlogBundle::layout.html.twig `` that contains
@@ -927,7 +927,7 @@ covered:
927
927
.. code-block :: html+jinja
928
928
929
929
{# src/Sensio/BlogBundle/Resources/views/layout.html.twig #}
930
- {% extends '::layout .html.twig' %}
930
+ {% extends '::base .html.twig' %}
931
931
932
932
{% block body %}
933
933
<h1>Blog Application</h1>
@@ -952,12 +952,12 @@ covered:
952
952
{% endblock %}
953
953
954
954
Notice that this template extends the section template -(``BlogBundle::layout.html.twig ``)
955
- which in-turn extends the base application layout (``::layout .html.twig ``).
955
+ which in-turn extends the base application layout (``::base .html.twig ``).
956
956
This is the common three-level inheritance model.
957
957
958
958
When building your application, you may choose to follow this method or simply
959
959
make each page template extend the base application template directly
960
- (e.g. ``{% extends '::layout .html.twig' %} ``). The three-template model is
960
+ (e.g. ``{% extends '::base .html.twig' %} ``). The three-template model is
961
961
a best-practice method used by vendor bundles so that the base template for
962
962
a bundle can be easily overriden to properly extend your application's base
963
963
layout.
0 commit comments