Skip to content

Commit eb776e8

Browse files
committed
docs: level up "Reverse Routing" and "Named Routes"
1 parent 3eaecb6 commit eb776e8

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

user_guide_src/source/incoming/routing.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -268,36 +268,6 @@ routes defined within this closure are only accessible from the given environmen
268268

269269
.. literalinclude:: routing/028.php
270270

271-
.. _reverse-routing:
272-
273-
Reverse Routing
274-
===============
275-
276-
Reverse routing allows you to define the controller and method, as well as any parameters, that a link should go
277-
to, and have the router lookup the current route to it. This allows route definitions to change without you having
278-
to update your application code. This is typically used within views to create links.
279-
280-
For example, if you have a route to a photo gallery that you want to link to, you can use the :php:func:`url_to()` helper
281-
function to get the route that should be used. The first parameter is the fully qualified Controller and method,
282-
separated by a double colon (``::``), much like you would use when writing the initial route itself. Any parameters that
283-
should be passed to the route are passed in next:
284-
285-
.. literalinclude:: routing/029.php
286-
287-
.. _using-named-routes:
288-
289-
Using Named Routes
290-
==================
291-
292-
You can name routes to make your application less fragile. This applies a name to a route that can be called
293-
later, and even if the route definition changes, all of the links in your application built with :php:func:`url_to()`
294-
will still work without you having to make any changes. A route is named by passing in the ``as`` option
295-
with the name of the route:
296-
297-
.. literalinclude:: routing/030.php
298-
299-
This has the added benefit of making the views more readable, too.
300-
301271
Routes with any HTTP verbs
302272
==========================
303273

@@ -461,6 +431,36 @@ be used when the first parameter is a language string:
461431

462432
.. literalinclude:: routing/042.php
463433

434+
.. _reverse-routing:
435+
436+
Reverse Routing
437+
***************
438+
439+
Reverse routing allows you to define the controller and method, as well as any parameters, that a link should go
440+
to, and have the router lookup the current route to it. This allows route definitions to change without you having
441+
to update your application code. This is typically used within views to create links.
442+
443+
For example, if you have a route to a photo gallery that you want to link to, you can use the :php:func:`url_to()` helper
444+
function to get the route that should be used. The first parameter is the fully qualified Controller and method,
445+
separated by a double colon (``::``), much like you would use when writing the initial route itself. Any parameters that
446+
should be passed to the route are passed in next:
447+
448+
.. literalinclude:: routing/029.php
449+
450+
.. _using-named-routes:
451+
452+
Named Routes
453+
************
454+
455+
You can name routes to make your application less fragile. This applies a name to a route that can be called
456+
later, and even if the route definition changes, all of the links in your application built with :php:func:`url_to()`
457+
will still work without you having to make any changes. A route is named by passing in the ``as`` option
458+
with the name of the route:
459+
460+
.. literalinclude:: routing/030.php
461+
462+
This has the added benefit of making the views more readable, too.
463+
464464
Grouping Routes
465465
***************
466466

0 commit comments

Comments
 (0)