Skip to content

Commit 9678b61

Browse files
committed
Proofread templating
1 parent 51773f4 commit 9678b61

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

book/templating.rst

+16-16
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,21 @@ By default, templates can live in two different locations:
388388

389389
* ``path/to/bundle/Resources/views/``: Each third party bundle houses its
390390
templates in its ``Resources/views`` directory (and subdirectories). When you
391-
plan to share your bundle, you should put the templates in the shared bundle
392-
instead of the ``app/Resources/views`` directory.
391+
plan to share your bundle, you should put the templates in the bundle instead
392+
of the ``app/`` directory.
393+
394+
Most of the templates you'll use live in the ``app/Resources/views/``
395+
directory. The path you'll use will be relative to this directory. For example,
396+
to render/extend ``app/Resources/views/base.html.twig``, you'll use the
397+
``base.html.twig`` path and to render/extend
398+
``app/Resources/views/Blog/index.html.twig``, you'll use the
399+
``Blog/index.html.twig`` path.
400+
401+
Referencing Templates in a Bundle
402+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
393403

394404
Symfony uses a **bundle**:**directory**:**filename** string syntax for
395-
templates. You can also give paths, which are relative to the
396-
``app/Resources/views`` directory. This allows for several different types of
405+
templates that live inside a bundle. This allows for several different types of
397406
templates, each which lives in a specific location:
398407

399408
* ``AcmeBlogBundle:Blog:index.html.twig``: This syntax is used to specify a
@@ -419,24 +428,15 @@ templates, each which lives in a specific location:
419428
Yes, there are 2 colons in the middle of the string when the "controller"
420429
subdirectory part is missing.
421430

422-
* ``::base.html.twig``: This syntax refers to views in ``app/Resources/views``.
423-
Notice that the string begins with two colons (``::``), meaning that both the
424-
*bundle* and *directory* portions are missing. This means that the template
425-
is not located in any bundle, but instead in the root
426-
``app/Resources/views/`` directory.
427-
428-
* ``base.html.twig``: Equivalent to ``::base.html.twig`` and **recommended**
429-
for application-wide templates.
430-
431431
In the :ref:`overriding-bundle-templates` section, you'll find out how each
432432
template living inside the ``AcmeBlogBundle``, for example, can be overridden
433433
by placing a template of the same name in the ``app/Resources/AcmeBlogBundle/views/``
434434
directory. This gives the power to override templates from any vendor bundle.
435435

436436
.. tip::
437437

438-
Hopefully the template naming syntax looks familiar - it's the same naming
439-
convention used to refer to :ref:`controller-string-syntax`.
438+
Hopefully the template naming syntax looks familiar - it's similair to the
439+
naming convention used to refer to :ref:`controller-string-syntax`.
440440

441441
Template Suffix
442442
~~~~~~~~~~~~~~~
@@ -1322,7 +1322,7 @@ covered:
13221322
template is called ``base.html.twig``;
13231323

13241324
* Create a template for each "section" of your site. For example, the blog
1325-
functionality would have a template called ``/Blog/layout.html.twig`` that
1325+
functionality would have a template called ``Blog/layout.html.twig`` that
13261326
contains only blog section-specific elements;
13271327

13281328
.. code-block:: html+jinja

0 commit comments

Comments
 (0)