CodeIgniter Forums
Class in nested folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Class in nested folder (/showthread.php?tid=15894)



Class in nested folder - El Forum - 02-18-2009

[eluser]yusrialfiansyah[/eluser]
I would create class like this :

http://mydomain/admin/student/add

but i want to place my 'student' class in folder controller/admin/student/student.php

Can someone help me?? thanks before.


Class in nested folder - El Forum - 02-18-2009

[eluser]srisa[/eluser]
If your folder structure is .system/controllers/admin/student/student.php , then url to access the add function in student class will be http://mydomain.com/admin/student/student/add. If you want to do away with the extra student in the url, place student.php in the .system/controllers/admin/ folder.


Class in nested folder - El Forum - 02-18-2009

[eluser]TheFuzzy0ne[/eluser]
One more thing to note is that you can only nest controllers up to one subdirectory deep.

./system/application/controllers/admin/student.php - You can easily access this.

./system/application/controllers/admin/student/student.php - You won't be able to access this controller.


Class in nested folder - El Forum - 02-18-2009

[eluser]yusrialfiansyah[/eluser]
No, i can't access it, even I use URL : http://mydomain.com/admin/student/student/add
Or i just forget some configuration there?


Class in nested folder - El Forum - 02-18-2009

[eluser]yusrialfiansyah[/eluser]
So i can't use this folder structure ya? And I should mix my admin-class into one folder 'admin'.
Or any solution there?


Class in nested folder - El Forum - 02-18-2009

[eluser]TheFuzzy0ne[/eluser]
The solution srisa posted will work. I was just pointing out that you can't nest controllers any deeper than you have.


Class in nested folder - El Forum - 02-18-2009

[eluser]Phil Sturgeon[/eluser]
For more admin-related separation techniques, take a look at this post:

http://ellislab.com/forums/viewreply/519469/