@@ -246,10 +246,12 @@ Create the Template
246
246
247
247
Templates allows us to move all of the presentation (e.g. HTML code) into
248
248
a separate file and reuse different portions of the page layout. Instead
249
- of writing the HTML inside the controller, use a template instead::
249
+ of writing the HTML inside the controller, use a template instead:
250
250
251
- // src/Acme/HelloBundle/Controller/HelloController.php
251
+ .. code-block :: php
252
+ :linenos:
252
253
254
+ // src/Acme/HelloBundle/Controller/HelloController.php
253
255
namespace Acme\HelloBundle\Controller;
254
256
255
257
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -267,9 +269,12 @@ of writing the HTML inside the controller, use a template instead::
267
269
268
270
.. note ::
269
271
270
- In order to use the ``render() `` method, you must extend the
271
- :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ Controller ` class, which
272
- adds shortcuts for tasks that are common inside controllers.
272
+ In order to use the ``render() `` method, your controller must extend the
273
+ ``Symfony\Bundle\FrameworkBundle\Controller\Controller `` class (API
274
+ docs: :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ Controller `),
275
+ which adds shortcuts for tasks that are common inside controllers. This
276
+ is done in the above example by adding the ``use `` statement on line 4
277
+ and then extending ``Controller `` on line 6.
273
278
274
279
The ``render() `` method creates a ``Response `` object filled with the content
275
280
of the given, rendered template. Like any other controller, you will ultimately
0 commit comments