diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index b4e0d4e19b0e..c9bd1e9eeb39 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -200,11 +200,19 @@ For example the route: will match **product/123**, **product/123/456**, **product/123/456/789** and so on. +In the above example, if the ``$1`` placeholder contains a slash +(``/``), it will still be split into multiple parameters when passed to +``Catalog::productLookup()``. + The implementation in the Controller should take into account the maximum parameters: .. literalinclude:: routing/011.php +Or you can use `variable-length argument lists `_: + +.. literalinclude:: routing/068.php + .. important:: Do not put any placeholder after ``(:any)``. Because the number of parameters passed to the controller method may change. @@ -249,6 +257,10 @@ redirect them back to the same page after they log in, you may find this example .. literalinclude:: routing/019.php +In the above example, if the ``$1`` placeholder contains a slash +(``/``), it will still be split into multiple parameters when passed to +``Auth::login()``. + For those of you who don't know regular expressions and want to learn more about them, `regular-expressions.info `_ might be a good starting point. diff --git a/user_guide_src/source/incoming/routing/011.php b/user_guide_src/source/incoming/routing/011.php index 2b5433da8d67..1aa779af3494 100644 --- a/user_guide_src/source/incoming/routing/011.php +++ b/user_guide_src/source/incoming/routing/011.php @@ -2,7 +2,7 @@ namespace App\Controllers; -class ProductController extends BaseController +class Catalog extends BaseController { public function productLookup($seg1 = false, $seg2 = false, $seg3 = false) { diff --git a/user_guide_src/source/incoming/routing/045.php b/user_guide_src/source/incoming/routing/045.php index e9534931dbc8..8c4c5e9616ee 100644 --- a/user_guide_src/source/incoming/routing/045.php +++ b/user_guide_src/source/incoming/routing/045.php @@ -8,6 +8,7 @@ class Routing extends BaseRouting // ... } +// In app/Config/Routes.php // Controller is \Users $routes->get('users', 'Users::index'); diff --git a/user_guide_src/source/incoming/routing/046.php b/user_guide_src/source/incoming/routing/046.php index 8998fe70c039..78768c76044a 100644 --- a/user_guide_src/source/incoming/routing/046.php +++ b/user_guide_src/source/incoming/routing/046.php @@ -1,6 +1,6 @@ setDefaultNamespace('App'); // Controller is \App\Users diff --git a/user_guide_src/source/incoming/routing/049.php b/user_guide_src/source/incoming/routing/049.php index 9f53bee87476..ea10d4e5b0fe 100644 --- a/user_guide_src/source/incoming/routing/049.php +++ b/user_guide_src/source/incoming/routing/049.php @@ -8,5 +8,5 @@ class Routing extends BaseRouting // ... } -// This can be overridden in the Routes file +// This can be overridden in app/Config/Routes.php $routes->setTranslateURIDashes(true); diff --git a/user_guide_src/source/incoming/routing/050.php b/user_guide_src/source/incoming/routing/050.php index 6f5446f5a654..155ac633568e 100644 --- a/user_guide_src/source/incoming/routing/050.php +++ b/user_guide_src/source/incoming/routing/050.php @@ -8,5 +8,5 @@ class Routing extends BaseRouting // ... } -// This can be overridden in the Routes file +// This can be overridden in app/Config/Routes.php $routes->setAutoRoute(false); diff --git a/user_guide_src/source/incoming/routing/051.php b/user_guide_src/source/incoming/routing/051.php index bced5d53147a..c84acce93d4b 100644 --- a/user_guide_src/source/incoming/routing/051.php +++ b/user_guide_src/source/incoming/routing/051.php @@ -8,6 +8,7 @@ class Routing extends BaseRouting // ... } +// In app/Config/Routes.php // Would execute the show404 method of the App\Errors class $routes->set404Override('App\Errors::show404'); diff --git a/user_guide_src/source/incoming/routing/052.php b/user_guide_src/source/incoming/routing/052.php index e3dd9f60c989..d9fb5998c21d 100644 --- a/user_guide_src/source/incoming/routing/052.php +++ b/user_guide_src/source/incoming/routing/052.php @@ -1,5 +1,14 @@ setPrioritize(); diff --git a/user_guide_src/source/incoming/routing/068.php b/user_guide_src/source/incoming/routing/068.php new file mode 100644 index 000000000000..50b0891ce928 --- /dev/null +++ b/user_guide_src/source/incoming/routing/068.php @@ -0,0 +1,13 @@ +