CodeIgniter Forums
Organizing Controllers into Subfolders - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Organizing Controllers into Subfolders (/thread-46622.html)

Organizing Controllers into Subfolders - El Forum - 11-08-2011

I'm building a site using CodeIgniter and up until now things have been going great. However, recently one of my controllers has been growing in size. I'd like to split the controller up into separate files within a sub-folder. Right now I have the following....


Within that controller I have a functions for all the different sections. So, the URL might be something like this...


I know I can setup a subfolder and have my URL be like the following....


But, I'd like to omit the 'usergroup' if at all possible. I'd like to do this by the following....

/controllers/dashboard/ -> If staff load staff.php, if user load user.php...etc.

This would be so much easier if I could just go....


How would you suggest I setup a dashboard area? Each usergroup has different things they need to access. Putting everything in one document is getting too long, and separating them out means I have to put the usergroup in the URL....yucky.

Is it possible to run a check in routes.php?

if ($this->user_model->is_user()) {
  // load this controller

Hope you guys have some suggestions for me!