Skip to content

Commit 1681df1

Browse files
authored
Merge pull request #8332 from kenjis/docs-controllers-auto-routing
docs: update config files for Auto Routing in controllers.rst
2 parents 4433c90 + 6ceb0fb commit 1681df1

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

user_guide_src/source/incoming/controllers.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,17 @@ Defining a Default Controller
313313

314314
Let's try it with the ``Helloworld`` controller.
315315

316-
To specify a default controller open your **app/Config/Routes.php**
317-
file and set this variable:
316+
To specify a default controller open your **app/Config/Routing.php**
317+
file and set this property::
318318

319-
.. literalinclude:: controllers/015.php
319+
public string $defaultController = 'Helloworld';
320320

321321
Where ``Helloworld`` is the name of the controller class you want to be used.
322322

323-
A few lines further down **Routes.php** in the "Route Definitions" section, comment out the line:
323+
And comment out the line in **app/Config/Routes.php**:
324324

325325
.. literalinclude:: controllers/016.php
326+
:lines: 2-
326327

327328
If you now browse to your site without specifying any URI segments you'll
328329
see the "Hello World" message.
@@ -332,8 +333,8 @@ see the "Hello World" message.
332333
precedence over Auto Routing, and controllers defined in the defined routes
333334
are denied access by Auto Routing (Improved) for security reasons.
334335

335-
For more information, please refer to the :ref:`routes-configuration-options` section of the
336-
:ref:`URI Routing <routing-auto-routing-improved-configuration-options>` documentation.
336+
For more information, please refer to the
337+
:ref:`routing-auto-routing-improved-configuration-options` documentation.
337338

338339
.. _controller-default-method-fallback:
339340

@@ -415,7 +416,7 @@ To call the above controller your URI will look something like this::
415416
Each of your sub-directories may contain a default controller which will be
416417
called if the URL contains *only* the sub-directory. Simply put a controller
417418
in there that matches the name of your default controller as specified in
418-
your **app/Config/Routes.php** file.
419+
your **app/Config/Routing.php** file.
419420

420421
CodeIgniter also permits you to map your URIs using its :ref:`Defined Route Routing <defined-route-routing>`..
421422

@@ -546,24 +547,25 @@ Defining a Default Controller (Legacy)
546547

547548
Let's try it with the ``Helloworld`` controller.
548549

549-
To specify a default controller open your **app/Config/Routes.php**
550-
file and set this variable:
550+
To specify a default controller open your **app/Config/Routing.php**
551+
file and set this property::
551552

552-
.. literalinclude:: controllers/015.php
553+
public string $defaultController = 'Helloworld';
553554

554555
Where ``Helloworld`` is the name of the controller class you want to be used.
555556

556-
A few lines further down **Routes.php** in the "Route Definitions" section, comment out the line:
557+
And comment out the line in **app/Config/Routes.php**:
557558

558559
.. literalinclude:: controllers/016.php
560+
:lines: 2-
559561

560562
If you now browse to your site without specifying any URI segments you'll
561563
see the "Hello World" message.
562564

563565
.. note:: The line ``$routes->get('/', 'Home::index');`` is an optimization that you will want to use in a "real-world" app. But for demonstration purposes we don't want to use that feature. ``$routes->get()`` is explained in :doc:`URI Routing <routing>`
564566

565-
For more information, please refer to the :ref:`routes-configuration-options` section of the
566-
:ref:`URI Routing <routing-auto-routing-legacy-configuration-options>` documentation.
567+
For more information, please refer to the the
568+
:ref:`routing-auto-routing-legacy-configuration-options` documentation.
567569

568570
Organizing Your Controllers into Sub-directories (Legacy)
569571
=========================================================
@@ -593,7 +595,7 @@ To call the above controller your URI will look something like this::
593595
Each of your sub-directories may contain a default controller which will be
594596
called if the URL contains *only* the sub-directory. Simply put a controller
595597
in there that matches the name of your default controller as specified in
596-
your **app/Config/Routes.php** file.
598+
your **app/Config/Routing.php** file.
597599

598600
CodeIgniter also permits you to map your URIs using its :ref:`Defined Route Routing <defined-route-routing>`..
599601

user_guide_src/source/incoming/controllers/015.php

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)