CodeIgniter Forums
Controllers in nested sub-folders - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Controllers in nested sub-folders (/showthread.php?tid=29561)



Controllers in nested sub-folders - El Forum - 04-13-2010

[eluser]pkorzeniewski[/eluser]
Hi,

Is it possible to put controllers into nested sub-folders - i.e:

/controllers/subdir1/subdir2/my_controller.php

and call it like:

www.example.com/subdir1/subdir2/my_controller ?

It doesn't work for me and I don't know if I'm doing something wrong or CI doesn't support nested sub-folders.

Regards,
Peter


Controllers in nested sub-folders - El Forum - 04-13-2010

[eluser]Jelmer[/eluser]
It's actually one of the few weak points of the User Guide, it's not made explicit that only one level of subfolder is supported. By default you can't use more then 1 level of depth, only way to support more levels is to extend the Router class yourself.


Controllers in nested sub-folders - El Forum - 04-13-2010

[eluser]pkorzeniewski[/eluser]
[quote author="Jelmer" date="1271216683"]It's actually one of the few weak points of the User Guide, it's not made explicit that only one level of subfolder is supported. By default you can't use more then 1 level of depth, only way to support more levels is to extend the Router class yourself.[/quote]

Yep you're right, I looked into Router class and it doesn't support nested subfolders however I changed it a little and now it does - if someone encounters similar problem, in attachment you'll find extended Router class with nested subfolders support, just put MY_Router.php into application/libraries folder.


Controllers in nested sub-folders - El Forum - 11-02-2012

[eluser]codeigniterzzz[/eluser]
pkorzeniewski: i copied that code into the application/libraries folder, but the nested controller folders aren't being recognized and i get a 404.


Controllers in nested sub-folders - El Forum - 11-02-2012

[eluser]CroNiX[/eluser]
That was written in 2010. I'm sure it was for an older version of CI.


Controllers in nested sub-folders - El Forum - 11-02-2012

[eluser]codeigniterzzz[/eluser]
well where's a new version...