Extending the Controller

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

#2
[eluser]tomcode[/eluser]
Try prefix MY_ instead of My_

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

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

#5
[eluser]JasonS[/eluser]
Ah, thanks a lot. I think I will opt for the first solution. Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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