CodeIgniter Forums
Codeigniter docs correction - routing - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Codeigniter docs correction - routing (/showthread.php?tid=88649)



Codeigniter docs correction - routing - bgeneto - 10-11-2023

I think that the following statement contained in the docs here https://www.codeigniter.com/user_guide/incoming/routing.html?highlight=routing#array-callable-syntax



If you forget to add `use App\Controllers\Home;`, the controller classname is interpreted as `Config\Home`, not `App\Controllers\Home` because **app/Config/Routes.php** has `namespace Config;` at the top.


is not valid anymore with the latest codeigniter version since Routes.php does not have the mentioned namespace. I find that it indeed is interpreted as App\Controllers 

unfortunately I was not able to find the docs repo in GitHub to contribute. I would like to know how to contribute with Codeigniter's documentation...

Regards.


RE: Codeigniter docs correction - routing - kenjis - 10-11-2023

Yes, now Routes.php does not have any namespace. That is in a global space.

> I find that it indeed is interpreted as App\Controllers

No, it is interpreted as \.
PHP Code:
$routes->get('/', [Home::class, 'index']); 


Quote:+--------+-------+------+--------------+----------------+---------------+
| Method | Route | Name | Handler      | Before Filters | After Filters |
+--------+-------+------+--------------+----------------+---------------+
| GET    | /    | »    | \Home::index |                | toolbar      |
+--------+-------+------+--------------+----------------+---------------+



RE: Codeigniter docs correction - routing - kenjis - 10-11-2023

(10-11-2023, 05:45 AM)bgeneto Wrote: unfortunately I was not able to find the docs repo in GitHub to contribute. I would like to know how to contribute with Codeigniter's documentation...

It is the main repository.
https://github.com/codeigniter4/CodeIgniter4

Also, you can create a PR from the "Edit this page" button in the upper right corner.
https://codeigniter4.github.io/CodeIgniter4/incoming/routing.html