Are there codeigniter controller sub-directory limits?
Greetings,
I've encountered a seemingly bizarre issue, and was wondering if anyone is able to shed a light.
I created a simple controller two levels down from the traditional /application/controllers/ directory and I'm seeing a CI-generated 404 when hitting said controller.
To elaborate, my directory structure is as follows: /ci/application/controllers/dir1/dir2/myfile.php
The file itself has a simple function with an echo statement. When I move said file up one level such that it is located in: /ci/application/controllers/dir1/myfile.php
It works.
I've tried changing the name of the "dir2" directory in the example above, the name of the control开发者_运维知识库ler, the names of the functions within the controller -- to no avail. I'm able to hit the same php file without going through the Code Igniter framework, and I'm on a Windows machine working normally so I can't imagine this to be a permissions-related issue.
I'm led to think that CI simply isn't willing to go into the controllers directory more than one level. Is this possible, or am I missing something?
Try this out: http://glennpratama.wordpress.com/2009/10/20/multi-level-subfolder-for-controller-in-codeigniter/
Basically, you need to override the default codeigniter router with your own MY_Router class
"Out of the box", Codeigniter only supports a single level directory structure for Controllers.
There are ways to extend the default Router class to enable this feature.
精彩评论