@@ -15,7 +15,7 @@ about this template engine. This section just gives you a quick overview
1515of its main concepts.
1616
1717A Twig template is a text file that can generate any type of content (HTML,
18- CSS, JavaScript, XML, CSV, LaTeX, etc.) Twig elements are separated from
18+ CSS, JavaScript, XML, CSV, LaTeX, etc.). Twig elements are separated from
1919the rest of the template contents using any of these delimiters:
2020
2121``{{ ... }} ``
@@ -50,7 +50,7 @@ Below is a minimal template that illustrates a few basics, using two variables
5050 </body>
5151 </html>
5252
53- To render a template in Symfony, use the ``render `` method from within a
53+ To render a template in Symfony, use the ``render() `` method from within a
5454controller. If the template needs variables to generate its contents, pass
5555them as an array using the second optional argument::
5656
@@ -160,7 +160,7 @@ Don't forget to check out the official `Twig documentation`_ to learn everything
160160about filters, functions and tags.
161161
162162Including other Templates
163- ~~~~~~~~~~~~~~~~~~~~~~~~~
163+ -------------------------
164164
165165The best way to share a snippet of code between several templates is to
166166create a new template fragment that can then be included from other templates.
@@ -190,7 +190,7 @@ using the ``include()`` function:
190190 {% endblock %}
191191
192192Embedding other Controllers
193- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
193+ ---------------------------
194194
195195And what if you want to embed the result of another controller in a template?
196196That's very useful when working with Ajax, or when the embedded template
@@ -212,7 +212,6 @@ action of the ``Default`` controller (the ``AppBundle`` part will be explained
212212later)::
213213
214214 // src/AppBundle/Controller/DefaultController.php
215-
216215 class DefaultController extends Controller
217216 {
218217 public function topArticlesAction()
@@ -229,31 +228,31 @@ later)::
229228 }
230229
231230Creating Links between Pages
232- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231+ ----------------------------
233232
234233Creating links between pages is a must for web applications. Instead of
235- hardcoding URLs in templates, the ``path `` function knows how to generate
236- URLs based on the routing configuration. That way, all your URLs can be
237- easily updated by just changing the configuration:
234+ hardcoding URLs in templates, the ``path() `` function knows how to generate
235+ URLs based on the routing configuration. That way, all your URLs
236+ can be easily updated by just changing the configuration:
238237
239238.. code-block :: html+twig
240239
241240 <a href="{{ path('homepage') }}">Return to homepage</a>
242241
243- The ``path `` function takes the route name as the first argument and you
242+ The ``path() `` function takes the route name as the first argument and you
244243can optionally pass an array of route parameters as the second argument.
245244
246245.. tip ::
247246
248- The ``url `` function is very similar to the ``path `` function, but generates
247+ The ``url() `` function is very similar to the ``path() `` function, but generates
249248 *absolute * URLs, which is very handy when rendering emails and RSS files:
250249 ``<a href="{{ url('homepage') }}">Visit our website</a> ``.
251250
252251Including Assets: Images, JavaScripts and Stylesheets
253- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252+ -----------------------------------------------------
254253
255254What would the Internet be without images, JavaScripts and stylesheets?
256- Symfony provides the ``asset `` function to deal with them easily:
255+ Symfony provides the ``asset() `` function to deal with them easily:
257256
258257.. code-block :: twig
259258
@@ -262,10 +261,11 @@ Symfony provides the ``asset`` function to deal with them easily:
262261 <img src="{{ asset('images/logo.png') }}" />
263262
264263 The ``asset() `` function looks for the web assets inside the ``web/ `` directory.
265- If you store them in another directory, read :doc: `this article </cookbook/assetic/asset_management >`
264+ If you store them in another directory, read
265+ :doc: `this article </cookbook/assetic/asset_management >`
266266to learn how to manage web assets.
267267
268- Using the ``asset `` function, your application is more portable. The reason
268+ Using the ``asset() `` function, your application is more portable. The reason
269269is that you can move the application root directory anywhere under your
270270web root directory without changing anything in your template's code.
271271
@@ -285,5 +285,5 @@ But I'm getting ahead of myself. First, you need to learn more about the
285285controller and that's exactly the topic of the :doc: `next part of this tutorial
286286<the_controller>`. Ready for another 10 minutes with Symfony?
287287
288- .. _ Twig : http://twig.sensiolabs.org/
289- .. _ Twig documentation : http://twig.sensiolabs.org/documentation
288+ .. _ `Twig` : http://twig.sensiolabs.org/
289+ .. _ `Twig documentation` : http://twig.sensiolabs.org/documentation
0 commit comments