@@ -391,9 +391,10 @@ By default, templates can live in two different locations:
391
391
plan to share your bundle, you should put the templates in the shared bundle
392
392
instead of the ``app/Resources/views `` directory.
393
393
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:
397
398
398
399
* ``AcmeBlogBundle:Blog:index.html.twig ``: This syntax is used to specify a
399
400
template for a specific page. The three parts of the string, each separated
@@ -402,26 +403,26 @@ lives in a specific location:
402
403
* ``AcmeBlogBundle ``: (*bundle *) the template lives inside the
403
404
``AcmeBlogBundle `` (e.g. ``src/Acme/BlogBundle ``);
404
405
405
- * ``Blog ``: (*controller *) indicates that the template lives inside the
406
+ * ``Blog ``: (*directory *) indicates that the template lives inside the
406
407
``Blog `` subdirectory of ``Resources/views ``;
407
408
408
- * ``index.html.twig ``: (*template *) the actual name of the file is
409
+ * ``index.html.twig ``: (*filename *) the actual name of the file is
409
410
``index.html.twig ``.
410
411
411
412
Assuming that the ``AcmeBlogBundle `` lives at ``src/Acme/BlogBundle ``, the
412
413
final path to the layout would be ``src/Acme/BlogBundle/Resources/views/Blog/index.html.twig ``.
413
414
414
415
* ``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 ",
416
417
portion is missing (e.g. ``Blog ``), the template lives at
417
418
``Resources/views/layout.html.twig `` inside ``AcmeBlogBundle ``.
418
419
Yes, there are 2 colons in the middle of the string when the "controller"
419
420
subdirectory part is missing.
420
421
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
425
426
``app/Resources/views/ `` directory.
426
427
427
428
* ``base.html.twig ``: Equivalent to ``::base.html.twig `` and **recommended **
0 commit comments