Welcome Guest, Not a member yet? Register   Sign In
Codeigniter docs correction - routing
#1

I think that the following statement contained in the docs here https://www.codeigniter.com/user_guide/i...ble-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.
Reply
#2

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      |
+--------+-------+------+--------------+----------------+---------------+
Reply
#3

(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/CodeIgnit...uting.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB