From 1c25c7c96bd2f3faaa471eff29d03fda1b02d7ee Mon Sep 17 00:00:00 2001 From: Marcel Korpel Date: Thu, 28 Dec 2017 04:03:05 +0100 Subject: [PATCH 1/3] Explain why the Web Debug Toolbar is gone When rendering a response using a template, the Web Debug Toolbar is gone, which was confusing to me. Only after searching I found the reason: there is no body element when using this rendering method. It seems logical to me to also explain extending a template to incorporate base.html.twig, so the Toolbar re-appears. --- page_creation.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/page_creation.rst b/page_creation.rst index c55c536b37e..4e494153b32 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -262,6 +262,20 @@ to get your *new* lucky number! http://localhost:8000/lucky/number +Now you may wonder where the Web Debug Toolbar has gone: that's because we don't write +a ``body`` element using the current template. If we incorporate the default +``base.html.twig``, which contains all default elements, including ``body``, you'll see +that the Toolbar re-appears: + +.. code-block:: diff + + {# templates/lucky/number.html.twig #} + + {% extends 'base.html.twig' %} + + + {% block body %} +

Your lucky number is {{ number }}

+ + {% endblock %} + In the :doc:`/templating` article, you'll learn all about Twig: how to loop, render other templates and leverage its powerful layout inheritance system. From 0c272c3c359d2ee4f29e8011afd27aa848769420 Mon Sep 17 00:00:00 2001 From: Marcel Korpel Date: Sat, 30 Dec 2017 18:58:28 +0100 Subject: [PATCH 2/3] Reword explanation --- page_creation.rst | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/page_creation.rst b/page_creation.rst index 4e494153b32..d3673c717b7 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -262,19 +262,7 @@ to get your *new* lucky number! http://localhost:8000/lucky/number -Now you may wonder where the Web Debug Toolbar has gone: that's because we don't write -a ``body`` element using the current template. If we incorporate the default -``base.html.twig``, which contains all default elements, including ``body``, you'll see -that the Toolbar re-appears: - -.. code-block:: diff - - {# templates/lucky/number.html.twig #} - + {% extends 'base.html.twig' %} - - + {% block body %} -

Your lucky number is {{ number }}

- + {% endblock %} +Now you may wonder where the Web Debug Toolbar has gone: that's because there is no ```` tag in the current template. You can add the body element yourself, or extend ``base.html.twig``, which contains all default HTML elements. In the :doc:`/templating` article, you'll learn all about Twig: how to loop, render other templates and leverage its powerful layout inheritance system. From b1cf4871a8c670daac2de24878de9434ca79fbe3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Jan 2018 15:39:04 +0100 Subject: [PATCH 3/3] Wrap long lines --- page_creation.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/page_creation.rst b/page_creation.rst index d3673c717b7..bb7af3c9cbe 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -262,7 +262,9 @@ to get your *new* lucky number! http://localhost:8000/lucky/number -Now you may wonder where the Web Debug Toolbar has gone: that's because there is no ```` tag in the current template. You can add the body element yourself, or extend ``base.html.twig``, which contains all default HTML elements. +Now you may wonder where the Web Debug Toolbar has gone: that's because there is +no ```` tag in the current template. You can add the body element yourself, +or extend ``base.html.twig``, which contains all default HTML elements. In the :doc:`/templating` article, you'll learn all about Twig: how to loop, render other templates and leverage its powerful layout inheritance system.