Skip to content

Commit 111ba93

Browse files
committed
Renamed app layout with base.html
1 parent 20bba4c commit 111ba93

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

book/templating.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ First, build a base layout file:
177177

178178
.. code-block:: html+jinja
179179

180-
{# app/views/layout.html.twig #}
180+
{# app/views/base.html.twig #}
181181
<!DOCTYPE html>
182182
<html>
183183
<head>
@@ -202,7 +202,7 @@ First, build a base layout file:
202202

203203
.. code-block:: php
204204
205-
<!-- app/views/layout.html.php -->
205+
<!-- app/views/base.html.php -->
206206
<!DOCTYPE html>
207207
<html>
208208
<head>
@@ -246,7 +246,7 @@ A child template might look like this:
246246
.. code-block:: html+jinja
247247

248248
{# src/Sensio/BlogBundle/Resources/views/Blog/index.html.twig #}
249-
{% extends '::layout.html.twig' %}
249+
{% extends '::base.html.twig' %}
250250

251251
{% block title %}My cool blog posts{% endblock %}
252252

@@ -260,7 +260,7 @@ A child template might look like this:
260260
.. code-block:: php
261261
262262
<!-- src/Sensio/BlogBundle/Resources/views/Blog/index.html.php -->
263-
<?php $view->extend('::layout.html.php') ?>
263+
<?php $view->extend('::base.html.php') ?>
264264
265265
<?php $view['slots']->set('title', 'My cool blog posts') ?>
266266
@@ -273,7 +273,7 @@ A child template might look like this:
273273
274274
.. note::
275275

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``)
277277
that indicates that the template lives in the ``app/views`` directory
278278
of the project. This naming convention is explained fully in
279279
:ref:`template-naming-locations`.
@@ -390,7 +390,7 @@ lives in a specific location:
390390
(``layout.html.twig``) lives simply in the ``Resources/views`` directory
391391
of the ``BlogBundle``.
392392

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
394394
or layout. Notice that the string begins with two colons (``::``), meaning
395395
that both the *bundle* and *controller* portions are missing. This means
396396
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**):
604604

605605
.. code-block:: html+jinja
606606

607-
{# app/views/layout.html.twig #}
607+
{# app/views/base.html.twig #}
608608
...
609609

610610
<div id="sidebar">
@@ -613,7 +613,7 @@ syntax for controllers (i.e. **bundle**:**controller**:**action**):
613613

614614
.. code-block:: php
615615
616-
<!-- app/views/layout.html.php -->
616+
<!-- app/views/base.html.php -->
617617
...
618618
619619
<div id="sidebar">
@@ -916,9 +916,9 @@ One common way to use inheritance is to use a three-level approach. This
916916
method works perfectly with the three different types of templates we've just
917917
covered:
918918

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
920920
for your application (like in the previous example). Internally, this template
921-
is called ``::layout.html.twig``;
921+
is called ``::base.html.twig``;
922922

923923
* Create a template for each "section" of your site. For example, a ``BlogBundle``,
924924
would have a template called ``BlogBundle::layout.html.twig`` that contains
@@ -927,7 +927,7 @@ covered:
927927
.. code-block:: html+jinja
928928

929929
{# src/Sensio/BlogBundle/Resources/views/layout.html.twig #}
930-
{% extends '::layout.html.twig' %}
930+
{% extends '::base.html.twig' %}
931931

932932
{% block body %}
933933
<h1>Blog Application</h1>
@@ -952,12 +952,12 @@ covered:
952952
{% endblock %}
953953

954954
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``).
956956
This is the common three-level inheritance model.
957957

958958
When building your application, you may choose to follow this method or simply
959959
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
961961
a best-practice method used by vendor bundles so that the base template for
962962
a bundle can be easily overriden to properly extend your application's base
963963
layout.

0 commit comments

Comments
 (0)