@@ -332,15 +332,15 @@ When working with template inheritance, here are some tips to keep in mind:
332332 and ``include `` it (see :ref: `including-templates `).
333333
334334* If you need to get the content of a block from the parent template, you
335- can use the ``{% parent %} `` tag . This is useful if you want to add to
336- the contents of a parent block instead of completely overriding it:
335+ can use the ``{{ parent() }} `` function . This is useful if you want to add
336+ to the contents of a parent block instead of completely overriding it:
337337
338338 .. code-block :: jinja
339339
340340 {% block sidebar %}
341341 <h3>Table of Contents</h3>
342342 ...
343- {% parent % }
343+ {{ parent() } }
344344 {% endblock %}
345345
346346 .. index ::
@@ -409,7 +409,7 @@ format. For more information, read the :ref:`template-formats` section.
409409.. tip ::
410410
411411 Hopefully the template naming syntax looks familiar - it's the same naming
412- convention used to refer to ` controllers </en/controllers> `.
412+ convention used to refer to :ref: ` controller-string-syntax `.
413413
414414.. tip ::
415415
@@ -437,7 +437,7 @@ ease the work of the template designer. In PHP, the templating system provides
437437an extensible *helper * system that provides useful features in a template
438438context.
439439
440- We've already seen a few built-in Twig tags (``{{ block }} `` & ``{{ extends } } ``)
440+ We've already seen a few built-in Twig tags (``{% block %} `` & ``{% extends % } ``)
441441as well as an example of a PHP helper (``$view['slots'] ``). Let's learn a
442442few more.
443443
@@ -796,27 +796,33 @@ configuration file:
796796 # app/config/config.yml
797797 framework :
798798 # ...
799- templating : {}
799+ templating : { engines: ['twig'] }
800800
801801 .. code-block :: xml
802802
803803 <!-- app/config/config.xml -->
804- <framework : config ...>
805- <!-- ... -->
806- <framework : templating />
807- </framework : config >
804+ <framework : templating cache-warmer =" true" >
805+ <framework : engine id =" twig" />
806+ </framework : templating >
808807
809808 .. code-block :: php
810809
811810 // app/config/config.php
812811 $container->loadFromExtension('framework', array(
813812 // ...
814- 'templating' => array(),
813+ 'templating' => array(
814+ 'engines' => array('twig'),
815+ ),
815816 ));
816817
817818 Several configuration options are available and are covered in the
818819:ref: `Configuration Appendix<appendix-templating-configuration> `.
819820
821+ .. note ::
822+
823+ The ``twig `` engine is mandatory to use the webprofiler (as well as many
824+ third-party bundles).
825+
820826.. index ::
821827 single; Template; Overriding templates
822828
@@ -856,7 +862,7 @@ in question lives at ``Resources/views/Blog/index.html.twig`` inside the
856862template to ``app/views/BlogBundle/Blog/index.html.twig `` (the ``BlogBundle ``
857863directory might not exist). Now, when you render the ``BlogBundle:Blog:index.html.twig ``
858864template, Symfony2 will look first for the template at ``app/views/BlogBundle/Blog/index.html.twig ``
859- before looking inside ``BlogBundle ``. You're know free to customize the template
865+ before looking inside ``BlogBundle ``. You're now free to customize the template
860866for your application.
861867
862868Suppose also that each template in ``BlogBundle `` inherits from a template
@@ -942,12 +948,12 @@ a bundle can be easily overriden to properly extend your application's base
942948layout.
943949
944950.. index ::
945- single: Templating; Output escapgin
951+ single: Templating; Output escaping
946952
947953Output Escaping
948954---------------
949955
950- When generating HTML from a template, there is awlays a risk that a template
956+ When generating HTML from a template, there is always a risk that a template
951957variable may output unintended HTML or dangerous client-side code. The result
952958is that dynamic content could break the HTML of the resulting page or allow
953959a malicious user to perform a `Cross Site Scripting `_ (XSS) attack. Consider
@@ -992,15 +998,16 @@ Output Escaping in Twig
992998
993999If you're using Twig templates, then output escaping is on by default. This
9941000means that you're protected out-of-the-box from the unintentional consequences
995- of user-submitted code.
1001+ of user-submitted code. By default, the output escaping assumes that content
1002+ is being escaped for HTML output.
9961003
9971004In some cases, you'll need to disable output escaping when you're rendering
9981005a variable that is trusted and contains markup that should not be escaped.
9991006Suppose that administrative users are able to write articles that contain
10001007HTML code. By default, Twig will escape the article body. To render it normally,
10011008add the ``raw `` filter: ``{{ article.body | raw }} ``.
10021009
1003- You can also to disable output escaping inside a ``{{ block } } `` area or
1010+ You can also to disable output escaping inside a ``{% block % } `` area or
10041011for an entire template. For more information, see `Output Escaping `_ in
10051012the Twig documentation.
10061013
0 commit comments