Extending the Controller - 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: Extending the Controller (/showthread.php?tid=27781) |
Extending the Controller - El Forum - 02-20-2010 [eluser]JasonS[/eluser] This works on my Mac but some reason, during the transfer to Linux it broke.. I have extended the Controller to add a number of admin functions. This is called My_Controller and has been placed in the application/libraries folder. On my Mac this works. Code: Class extends My_Controller { This doesn't work as none of the extra functions are added. Code: Class extends Controller On my Linux build My_Controller cannot be found.. Anyone have any ideas why this would be? Also, if I wanted to change My_Controller to admin controller, is there anyway to autoload it without it being executed? This would probably work out better than just extending the base controller. Extending the Controller - El Forum - 02-20-2010 [eluser]tomcode[/eluser] Try prefix MY_ instead of My_ Extending the Controller - El Forum - 02-20-2010 [eluser]JasonS[/eluser] Ah ofcourse, Linux has case sensitive file names... which differ's from Windows / Mac which is case insensitive. Any idea how to fork the Controller so that I could have a front controller and an admin controller? Extending the Controller - El Forum - 02-20-2010 [eluser]heavenquake[/eluser] [quote author="JasonS" date="1266720843"]Ah ofcourse, Linux has case sensitive file names... which differ's from Windows / Mac which is case insensitive. Any idea how to fork the Controller so that I could have a front controller and an admin controller?[/quote] A simple solution is to have the file called MY_Controller.php, and then just declare Front_Controller and Admin_Controller in that same file. This is PHP4 compatible. Personally I have a pre_system hook that implements magic autoload ( http://php.net/autoload ) and then I just declare the master-controllers in the controllers-dir along with the others. This is not PHP4-compatible. Extending the Controller - El Forum - 02-20-2010 [eluser]JasonS[/eluser] Ah, thanks a lot. I think I will opt for the first solution. |