@@ -314,7 +314,7 @@ controller, and ``index.html.twig`` the template:
314
314
:linenos:
315
315
316
316
{# src/Acme/HelloBundle/Resources/views/Hello/index.html.twig #}
317
- {% extends '::layout .html.twig' %}
317
+ {% extends '::base .html.twig' %}
318
318
319
319
{% block body %}
320
320
Hello {{ name }}!
@@ -323,7 +323,7 @@ controller, and ``index.html.twig`` the template:
323
323
.. code-block :: php
324
324
325
325
<!-- src/Acme/HelloBundle/Resources/views/Hello/index.html.php -->
326
- <?php $view->extend('::layout .html.php') ?>
326
+ <?php $view->extend('::base .html.php') ?>
327
327
328
328
Hello <?php echo $view->escape($name) ?>!
329
329
@@ -334,10 +334,10 @@ Let's step through the Twig template line-by-line:
334
334
335
335
* *line 4 *: The ``block `` token says that everything inside should be placed
336
336
inside a block called ``body ``. As you'll see, it's the responsibility
337
- of the parent template (``layout .html.twig ``) to ultimately render the
337
+ of the parent template (``base .html.twig ``) to ultimately render the
338
338
block called ``body ``.
339
339
340
- The parent template, ``::layout .html.twig ``, is missing both the **BundleName **
340
+ The parent template, ``::base .html.twig ``, is missing both the **BundleName **
341
341
and **ControllerName ** portions of its name (hence the double colon (``:: ``)
342
342
at the beginning). This means that the template lives outside of the bundles
343
343
and in the ``app `` directory:
@@ -346,29 +346,35 @@ and in the ``app`` directory:
346
346
347
347
.. code-block :: html+jinja
348
348
349
- {# app/Resources/views/layout .html.twig #}
349
+ {# app/Resources/views/base .html.twig #}
350
350
<!DOCTYPE html>
351
351
<html>
352
352
<head>
353
353
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
354
- <title>{% block title %}Hello Application{% endblock %}</title>
354
+ <title>{% block title %}Welcome!{% endblock %}</title>
355
+ {% block stylesheets %}{% endblock %}
356
+ <link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
355
357
</head>
356
358
<body>
357
359
{% block body %}{% endblock %}
360
+ {% block javascripts %}{% endblock %}
358
361
</body>
359
362
</html>
360
363
361
364
.. code-block :: php
362
365
363
- <!-- app/Resources/views/layout .html.php -->
366
+ <!-- app/Resources/views/base .html.php -->
364
367
<!DOCTYPE html>
365
368
<html >
366
369
<head >
367
370
<meta http-equiv =" Content-Type" content =" text/html; charset=utf-8" />
368
- <title ><?php $view['slots']->output('title', 'Hello Application') ?></title >
371
+ <title ><?php $view['slots']->output('title', 'Welcome!') ?></title >
372
+ <?php $view['slots']->output('stylesheets') ?>
373
+ <link rel =" shortcut icon" href =" <?php echo $view['assets']->getUrl('favicon.ico') ?>" />
369
374
</head >
370
375
<body >
371
376
<?php $view['slots']->output('_content') ?>
377
+ <?php $view['slots']->output('stylesheets') ?>
372
378
</body >
373
379
</html >
374
380
0 commit comments