@@ -134,7 +134,7 @@ Later, you'll use it to generate URLs.
134
134
.. sidebar :: Routing in Other Formats
135
135
136
136
The ``@Route `` above each method is called an *annotation *. If you'd rather
137
- configure your routes in Yaml , XML or PHP, that's no problem!
137
+ configure your routes in YAML , XML or PHP, that's no problem!
138
138
139
139
In these formats, the ``_controller `` "defaults" value is a special key that
140
140
tells Symfony which controller should be executed when a URL matches this route.
@@ -150,8 +150,8 @@ even the most complex URLs easy.
150
150
151
151
.. _routing-requirements :
152
152
153
- Adding {placeholder } Requirements
154
- ---------------------------------
153
+ Adding {wildcard } Requirements
154
+ ------------------------------
155
155
156
156
Imagine the ``blog_list `` route will contain a paginated list of blog posts, with
157
157
URLs like ``/blog/2 `` and ``/blog/3 `` for pages 2 and 3. If you change the route's
@@ -648,41 +648,7 @@ Generating URLs from a Template
648
648
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
649
649
650
650
To generate URLs inside Twig, see the templating chapter: :ref: `book-templating-pages `.
651
-
652
- Generating URLs in JavaScript
653
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
654
-
655
- If you're in a Twig template, you can use the same ``path `` function to set JavaScript
656
- variables. The ``escape `` function helps escape any non-JavaScript-safe values:
657
-
658
- .. configuration-block ::
659
-
660
- .. code-block :: html+twig
661
-
662
- <script>
663
- var route = "{{ path('blog_show', {'slug': 'my-blog-post'})|escape('js') }}";
664
- </script>
665
-
666
- .. code-block :: html+php
667
-
668
- <script>
669
- var route = "<?php echo $view->escape(
670
- $view['router']->generate('blow_show', array(
671
- 'slug' => 'my-blog-post',
672
- )),
673
- 'js'
674
- ) ?>";
675
- </script>
676
-
677
- But if you *actually * need to generate routes in pure JavaScript, consider using
678
- the `FOSJsRoutingBundle `_. It makes the following possible:
679
-
680
- .. code-block :: javascript
681
-
682
- var url = Routing .generate (
683
- ' blog_show' ,
684
- {' slug' : ' my-blog-post' }
685
- );
651
+ If you also need to generate URLs in JavaScript, see :doc: `/routing/generate_url_javascript `.
686
652
687
653
.. index ::
688
654
single: Routing; Absolute URLs
0 commit comments