Skip to content

Commit

Permalink
Merge pull request #8332 from kenjis/docs-controllers-auto-routing
Browse files Browse the repository at this point in the history
docs: update config files for Auto Routing in controllers.rst
  • Loading branch information
kenjis authored Dec 20, 2023
2 parents 4433c90 + 6ceb0fb commit 1681df1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
30 changes: 16 additions & 14 deletions user_guide_src/source/incoming/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,17 @@ Defining a Default Controller

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

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

.. literalinclude:: controllers/015.php
public string $defaultController = 'Helloworld';

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

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

.. literalinclude:: controllers/016.php
:lines: 2-

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

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

.. _controller-default-method-fallback:

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

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

Expand Down Expand Up @@ -546,24 +547,25 @@ Defining a Default Controller (Legacy)

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

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

.. literalinclude:: controllers/015.php
public string $defaultController = 'Helloworld';

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

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

.. literalinclude:: controllers/016.php
:lines: 2-

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

.. 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>`

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

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

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

Expand Down
3 changes: 0 additions & 3 deletions user_guide_src/source/incoming/controllers/015.php

This file was deleted.

0 comments on commit 1681df1

Please sign in to comment.