CodyRob CodyRob - 1 year ago 107
PHP Question

Route to multiple sub folders in CodeIgniter

I have a admin folder set up in my controllers directory, under that i have 3 seperate sub-folders with controllers inside of them.

-- Controllers
---- Admin
------ Dashboard
-------- dashboard.php
-------- file.php
------ Members
-------- members.php
-------- file.php
------ Settings
-------- settings.php
-------- file.php

I tried routing it in the routes.php file like this

$route['admin/(:any)/(:any)'] = 'admin/$1/$2';
$route['admin/(:any)'] = 'admin/$1/$1';
$route['admin'] = 'admin/index';

What do I do to fix this?

Answer Source

"Out of the Box" codeigniter does not support multiple subdirectory levels in your controllers directory, just one.

There is a way to extend the routing class to support this, check this blog entry.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download