@@ -26,11 +26,11 @@ Usage
2626
2727The:class: `Symfony\\ Component\\ Templating\\ PhpEngine ` class is the entry point
2828of the component. It needs a
29- :class: ` template name parser< Symfony\\ Component\\ Templating\\ TemplateNameParserInterface> `
29+ template name parser( :class: ` Symfony\\ Component\\ Templating\\ TemplateNameParserInterface `)
3030to convert a template name to a
31- :class: ` template reference< Symfony\\ Component\\ Templating\\ TemplateReferenceInterface> `
32- and :class: ` template loader< Symfony\\ Component\\ Templating\\ Loader\\ LoaderInterface> `
33- to find the templateassociated toa reference ::
31+ template reference( :class: ` Symfony\\ Component\\ Templating\\ TemplateReferenceInterface `).
32+ It also needs a template loader( :class: ` Symfony\\ Component\\ Templating\\ Loader\\ LoaderInterface `)
33+ which uses the templatereference toactually find and load the template ::
3434
3535 use Symfony\Component\Templating\PhpEngine;
3636 use Symfony\Component\Templating\TemplateNameParser;
@@ -57,16 +57,16 @@ The ``$view`` variable
5757
5858In all templates parsed by the ``PhpEngine ``, you get access to a mysterious
5959variable called ``$view ``. That variable holds the current ``PhpEngine ``
60- instance. That means you get access to a bunch of methods thatmakes your life
60+ instance. That means you get access to a bunch of methods thatmake your life
6161easier.
6262
6363Including Templates
6464-------------------
6565
66- The best way to share a snippet of template code is todefine a template that
67- can then be includedinto other templates. As the ``$view `` variable is an
66+ The best way to share a snippet of template code is tocreate a template that
67+ can then be includedby other templates. As the ``$view `` variable is an
6868instance of ``PhpEngine ``, you can use the ``render `` method (which was used
69- to render the template) inside the template to render another template::
69+ to render the template originally ) inside the template to render another template::
7070
7171 <?php $names = array('Fabien', ...) ?>
7272 <?php foreach ($names as $name) : ?>
@@ -76,18 +76,20 @@ to render the template) inside the template to render another template::
7676Output Escaping
7777---------------
7878
79- When you display variables to the user, you should escape them using the
79+ When you render variables, you should probably escape them so that HTML or
80+ JavaScript code isn't written out to your page. This will prevent things like
81+ XSS attacks. To do this, use the
8082:method: `Symfony\\ Component\\ Templating\\ PhpEngine::escape ` method::
8183
8284 <?php echo $view->escape($firstname) ?>
8385
8486By default, the ``escape() `` method assumes that the variable is outputted
8587within an HTML context. The second argument lets you change the context. For
86- instance , to output somethingin a JavaScript script , use the ``js `` context::
88+ example , to output somethinginside JavaScript, use the ``js `` context::
8789
8890 <?php echo $view->escape($var, 'js') ?>
8991
90- Thecomponents comes witha HTML and JS escaper. You can register your own
92+ Thecomponent comes withan HTML and JS escaper. You can register your own
9193escaper using the
9294:method: `Symfony\\ Component\\ Templating\\ PhpEngine::setEscaper ` method::
9395
@@ -101,10 +103,10 @@ Helpers
101103-------
102104
103105The Templating component can be easily extended via helpers. The component has
104- 2build -in helpers:
106+ 2built -in helpers:
105107
106- *:doc: `/components/helpers/assetshelper `
107- *:doc: `/components/helpers/slotshelper `
108+ *:doc: `/components/templating/ helpers/assetshelper `
109+ *:doc: `/components/templating/ helpers/slotshelper `
108110
109111Before you can use these helpers, you need to register them using
110112:method: `Symfony\\ Component\\ Templating\\ PhpEngine::set `::