Skip to content

Commit a8a75d7

Browse files
committed
Changed Bundle:Controller:Template to bundle:dir:file
1 parent db3086d commit a8a75d7

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

book/templating.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,10 @@ By default, templates can live in two different locations:
391391
plan to share your bundle, you should put the templates in the shared bundle
392392
instead of the ``app/Resources/views`` directory.
393393

394-
Symfony uses a **bundle**:**controller**:**template** string syntax for
395-
templates. This allows for several different types of templates, each which
396-
lives in a specific location:
394+
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
397+
templates, each which lives in a specific location:
397398

398399
* ``AcmeBlogBundle:Blog:index.html.twig``: This syntax is used to specify a
399400
template for a specific page. The three parts of the string, each separated
@@ -402,26 +403,26 @@ lives in a specific location:
402403
* ``AcmeBlogBundle``: (*bundle*) the template lives inside the
403404
``AcmeBlogBundle`` (e.g. ``src/Acme/BlogBundle``);
404405

405-
* ``Blog``: (*controller*) indicates that the template lives inside the
406+
* ``Blog``: (*directory*) indicates that the template lives inside the
406407
``Blog`` subdirectory of ``Resources/views``;
407408

408-
* ``index.html.twig``: (*template*) the actual name of the file is
409+
* ``index.html.twig``: (*filename*) the actual name of the file is
409410
``index.html.twig``.
410411

411412
Assuming that the ``AcmeBlogBundle`` lives at ``src/Acme/BlogBundle``, the
412413
final path to the layout would be ``src/Acme/BlogBundle/Resources/views/Blog/index.html.twig``.
413414

414415
* ``AcmeBlogBundle::layout.html.twig``: This syntax refers to a base template
415-
that's specific to the ``AcmeBlogBundle``. Since the middle, "controller",
416+
that's specific to the ``AcmeBlogBundle``. Since the middle, "directory",
416417
portion is missing (e.g. ``Blog``), the template lives at
417418
``Resources/views/layout.html.twig`` inside ``AcmeBlogBundle``.
418419
Yes, there are 2 colons in the middle of the string when the "controller"
419420
subdirectory part is missing.
420421

421-
* ``::base.html.twig``: This syntax refers to an application-wide base template
422-
or layout. Notice that the string begins with two colons (``::``), meaning
423-
that both the *bundle* and *controller* portions are missing. This means
424-
that the template is not located in any bundle, but instead in the root
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
425426
``app/Resources/views/`` directory.
426427

427428
* ``base.html.twig``: Equivalent to ``::base.html.twig`` and **recommended**

0 commit comments

Comments
 (0)