Controllers in nested sub-folders

#1
[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

#2
[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.

#3
[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.

#4
[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.

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

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.