From 181b2d2136a3e7489d14e2a3b535e470e9439138 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 14 Dec 2023 19:39:34 +0900 Subject: [PATCH 1/2] docs: update sample code and descriptions --- user_guide_src/source/incoming/routing.rst | 38 ++++++++++--------- .../source/incoming/routing/047.php | 4 -- .../source/incoming/routing/048.php | 3 -- 3 files changed, 21 insertions(+), 24 deletions(-) delete mode 100644 user_guide_src/source/incoming/routing/047.php delete mode 100644 user_guide_src/source/incoming/routing/048.php diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index 81304cf25a8c..bb501ba6cc0d 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -740,7 +740,7 @@ See :ref:`Auto Routing in Controllers ` for mo Configuration Options ===================== -These options are available at the top of **app/Config/Routes.php**. +These options are available at the top of **app/Config/Routing.php**. Default Controller ------------------ @@ -748,13 +748,14 @@ Default Controller For Site Root URI ^^^^^^^^^^^^^^^^^ -When a user visits the root of your site (i.e., **example.com**) the controller to use is determined by the value set by -the ``setDefaultController()`` method, unless a route exists for it explicitly. +When a user visits the root of your site (i.e., **example.com**) the controller +to use is determined by the value set to the ``$defaultController`` property, +unless a route exists for it explicitly. -The default value for this is ``Home`` -which matches the controller at **app/Controllers/Home.php**: +The default value for this is ``Home`` which matches the controller at +**app/Controllers/Home.php**:: -.. literalinclude:: routing/047.php + public string $defaultController = 'Home'; For Directory URI ^^^^^^^^^^^^^^^^^ @@ -775,10 +776,10 @@ This works similar to the default controller setting, but is used to determine t when a controller is found that matches the URI, but no segment exists for the method. The default value is ``index``. -In this example, if the user were to visit **example.com/products**, and a ``Products`` controller existed, the -``Products::getListAll()`` method would be executed: +In this example, if the user were to visit **example.com/products**, and a ``Products`` +controller existed, the ``Products::getListAll()`` method would be executed:: -.. literalinclude:: routing/048.php + public string $defaultMethod = 'listAll'; .. important:: You cannot access the controller with the URI of the default method name. In the example above, you can access **example.com/products**, but if you access **example.com/products/listall**, it will be not found. @@ -868,7 +869,7 @@ See :ref:`Auto Routing (Legacy) in Controllers ` Configuration Options (Legacy) ============================== -These options are available at the top of **app/Config/Routes.php**. +These options are available at the top of **app/Config/Routing.php**. Default Controller (Legacy) --------------------------- @@ -876,11 +877,14 @@ Default Controller (Legacy) For Site Root URI (Legacy) ^^^^^^^^^^^^^^^^^^^^^^^^^^ -When a user visits the root of your site (i.e., example.com) the controller to use is determined by the value set by -the ``setDefaultController()`` method, unless a route exists for it explicitly. The default value for this is ``Home`` -which matches the controller at **app/Controllers/Home.php**: +When a user visits the root of your site (i.e., **example.com**) the controller +to use is determined by the value set to the ``$defaultController`` property, +unless a route exists for it explicitly. -.. literalinclude:: routing/047.php +The default value for this is ``Home`` which matches the controller at +**app/Controllers/Home.php**:: + + public string $defaultController = 'Home'; For Directory URI (Legacy) ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -898,10 +902,10 @@ This works similar to the default controller setting, but is used to determine t when a controller is found that matches the URI, but no segment exists for the method. The default value is ``index``. -In this example, if the user were to visit **example.com/products**, and a ``Products`` controller existed, the -``Products::listAll()`` method would be executed: +In this example, if the user were to visit **example.com/products**, and a ``Products`` +controller existed, the ``Products::listAll()`` method would be executed:: -.. literalinclude:: routing/048.php + public string $defaultMethod = 'listAll'; Confirming Routes ***************** diff --git a/user_guide_src/source/incoming/routing/047.php b/user_guide_src/source/incoming/routing/047.php deleted file mode 100644 index d8ff31b84493..000000000000 --- a/user_guide_src/source/incoming/routing/047.php +++ /dev/null @@ -1,4 +0,0 @@ -setDefaultController('Home'); diff --git a/user_guide_src/source/incoming/routing/048.php b/user_guide_src/source/incoming/routing/048.php deleted file mode 100644 index e926e651287d..000000000000 --- a/user_guide_src/source/incoming/routing/048.php +++ /dev/null @@ -1,3 +0,0 @@ -setDefaultMethod('listAll'); From 5c4c72c1b8b0bf3089a48ae00e2925dad6425ea2 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 14 Dec 2023 20:23:19 +0900 Subject: [PATCH 2/2] docs: update description --- user_guide_src/source/incoming/routing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index bb501ba6cc0d..b4e0d4e19b0e 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -740,7 +740,7 @@ See :ref:`Auto Routing in Controllers ` for mo Configuration Options ===================== -These options are available at the top of **app/Config/Routing.php**. +These options are available in the **app/Config/Routing.php** file. Default Controller ------------------ @@ -869,7 +869,7 @@ See :ref:`Auto Routing (Legacy) in Controllers ` Configuration Options (Legacy) ============================== -These options are available at the top of **app/Config/Routing.php**. +These options are available in the **app/Config/Routing.php** file. Default Controller (Legacy) ---------------------------