MY_Controller technique not working with Reactor |
[eluser]Wayne Smallman[/eluser]
[quote author="InsiteFX" date="1298181588"]Any Class that is in th systen/core directory that is extened has to be placed into the application/core directory. These are Core Classes. MY_Controller is extending the system/core/CI_Controller, as you can see this is a Core Class. Any Class that is extended that is in the system/libraries directory has to be placed into the application/libraries directory. These are Library Classes.[/quote]So would I be right in assuming the previous versions of CodeIgniter, prior to 2.0.x were quite relaxed in their handling of this hierarchy? As I said, I'm working in a 1.7.x version and I have the MY_Controller in the application/libraries folder and it's working just fine.
[eluser]moodh[/eluser]
[quote author="Wayne Smallman" date="1298243453"][quote author="InsiteFX" date="1298181588"]Any Class that is in th systen/core directory that is extened has to be placed into the application/core directory. These are Core Classes. MY_Controller is extending the system/core/CI_Controller, as you can see this is a Core Class. Any Class that is extended that is in the system/libraries directory has to be placed into the application/libraries directory. These are Library Classes.[/quote]So would I be right in assuming the previous versions of CodeIgniter, prior to 2.0.x were quite relaxed in their handling of this hierarchy? As I said, I'm working in a 1.7.x version and I have the MY_Controller in the application/libraries folder and it's working just fine.[/quote] The Core separation didn't exist prior to 2.0
[eluser]Wayne Smallman[/eluser]
[quote author="narcisha" date="1298244433"][quote author="Wayne Smallman" date="1298243453"][quote author="InsiteFX" date="1298181588"]Any Class that is in th systen/core directory that is extened has to be placed into the application/core directory. These are Core Classes. MY_Controller is extending the system/core/CI_Controller, as you can see this is a Core Class. Any Class that is extended that is in the system/libraries directory has to be placed into the application/libraries directory. These are Library Classes.[/quote]So would I be right in assuming the previous versions of CodeIgniter, prior to 2.0.x were quite relaxed in their handling of this hierarchy? As I said, I'm working in a 1.7.x version and I have the MY_Controller in the application/libraries folder and it's working just fine.[/quote] The Core separation didn't exist prior to 2.0[/quote]Fair enough.
[eluser]Dom Smith[/eluser]
Hi guys, I was having the same problem when trying to extend the extended MY_Controller class. I followed InsiteFX's advice by putting all 3 files in the application/core folder but for some reason still can't get it to work. My 3 files are named MY_Controller.php, Admin_Controller.php and Public_Controller.php and are all in application/core. I've taken any code out of them and used the code above. I then have a basic controller in application/controllers and when I extend Public_Controller it servers nothing, not even an error, but when I extend MY_Controller I get the correct output. Anyone know what might be happening here? Any advice will be much appreciated. Cheers.
[eluser]LuckyFella73[/eluser]
Please post your basic controller, maybe it's just a typo. Without seeing any code its hard to tell.
[eluser]Dom Smith[/eluser]
Code: // application/core/MY_Controller.php Code: // application/core/Public_Controller.php Code: // application/core/Admin_Controller.php Code: // application/controller/welcome.php Code: // application/controller/welcome.php Hope this helps, Thanks.
[eluser]LuckyFella73[/eluser]
I guess you need to extend the config.php file - in case you didn't allready. Put this at the end of the file and try again: Code: /* This is part of Phil Sturgeons tutorial how to extend the CI controller. In case you havn't read it yet: http://philsturgeon.co.uk/news/2010/02/C...ing-it-DRY
[eluser]Dom Smith[/eluser]
Perfect!! That was exactly what was wrong! I'd been using his method in a CI 1.7.2 version and it was working and was trying to convert it to 2.0 and that's what I'd missed off! Was a while ago when I implemented it so forgot about that addition. Thanks for the help!
[eluser]InsiteFX[/eluser]
Mine is working with out the autoload, but maybe it is because I use HMVC. InsiteFX
[eluser]LuckyFella73[/eluser]
It's like you said - when you have HMVC running you don't need to place the autoload-code in your config.php I just checked with a fresh installation to be sure |
Welcome Guest, Not a member yet? Register Sign In |