@@ -34,7 +34,7 @@ Creating a Page: Route and Controller
34
34
35
35
Suppose you want to create a page - ``/lucky/number `` - that generates a
36
36
lucky (well, random) number and prints it. To do that, create a class and
37
- a method inside of it that will be executed when someone goes to ``/lucky/random ``::
37
+ a method inside of it that will be executed when someone goes to ``/lucky/number ``::
38
38
39
39
// src/AppBundle/Controller/LuckyController.php
40
40
namespace AppBundle\Controller;
@@ -60,8 +60,6 @@ a method inside of it that will be executed when someone goes to ``/lucky/random
60
60
61
61
Before diving into this, test it out!
62
62
63
- .. code-block :: text
64
-
65
63
http://localhost:8000/app_dev.php/lucky/number
66
64
67
65
.. tip ::
@@ -129,8 +127,6 @@ Just add a second method to ``LuckyController``::
129
127
130
128
Try this out in your browser:
131
129
132
- .. code-block :: text
133
-
134
130
http://localhost:8000/app_dev.php/api/lucky/number
135
131
136
132
You can even shorten this with the handy :class: `Symfony\\ Component\\ HttpFoundation\\ JsonResponse `::
@@ -252,8 +248,6 @@ The best part is that you can access this value and use it in your controller::
252
248
253
249
Try it by going to ``/lucky/number/XX `` - replacing XX with *any * number:
254
250
255
- .. code-block :: text
256
-
257
251
http://localhost:8000/app_dev.php/lucky/number/7
258
252
259
253
You should see *7 * lucky numbers printed out! You can get the value of any
@@ -411,8 +405,6 @@ to put the content into the middle of the ``base.html.twig`` layout.
411
405
412
406
Refresh to see your template in action!
413
407
414
- .. code-block :: text
415
-
416
408
http://localhost:8000/app_dev.php/lucky/number/9
417
409
418
410
If you view the source code, you now have a basic HTML structure thanks to
0 commit comments