Okay, so I'm trying to create an admin section for my web app powered by Code Igniter, but I'm getting quite confused. I heard that CodeIgniter allows for controllers to be nested within subfolders under the controller directory, but I can't get that to work.
For an example, I have my directory set up like this:
CI
|-controllers
| |------admin
| | |--main.php
| | |--project.php
| |
| |--page.php
|...
and my routing like this:
$route['admin/'] = "admin/index";
$route['admin/index'] = "admin/index";
$route['admin/project/(:any)'] = "admin/project/$1";
$route['admin/project'] = "admin/project/list";
but none of the routes are working except for the plain admin one. Am I missing a config setting or something? Would someone explain routing controllers within subfolders to me?
Actually, I figured out my problem. I had been refactoring some code and in doing so, I needed to split up some files. I just used "Save As..." and copy and paste, and in doing so, I forgot to rename my classes. I wasn't realizing this because my file names were right, but the classes they contained respectively weren't named the same way.
I had class Admin extends CI_Controller{
in admin/main.php
, instead of class Main
...