load Controller in Controller, CI3 |
hi
I can't load controller in another controller in CI3, but in CI2 i do this without problem!!! for test plz create MY_Controller in core and load a test library or model or etc then in welcome controller or each controller you want, load another controller like my codes then see errors, i cant know why this doesn't work in CI3 plz help me and other question why CI2 benchmark is very better than CI3? it isn't bad? do you recommended me for use CI2? "please sorry if you found any mistake in my english" --- MY_Controller: PHP Code: class MY_Controller extends CI_Controller and this is my welcome controller PHP Code: defined('BASEPATH') OR exit('No direct script access allowed'); and my _404 controller PHP Code: defined('BASEPATH') OR exit('No direct script access allowed');
Not sure if I understand your problem correctly, but I was able to load controller where ever I wan't without errors in CI3 too after I moved most of the autoload stuff to MY_Controller instead autoload config. If Session, Form_validation, Pagination etc. are in autoload, you get bunch of different errors.
http://www.jammeri.com/post/loading-cont...igniter-30
Why on earth would you want to do something like this?
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
(08-03-2015, 12:21 PM)zeos Wrote: for custom 404 error page i would do this Why wouldn't you use show_404() or the 404_override route?
(07-31-2015, 11:30 AM)Jammyman Wrote: Not sure if I understand your problem correctly, but I was able to load controller where ever I wan't without errors in CI3 too after I moved most of the autoload stuff to MY_Controller instead autoload config. If Session, Form_validation, Pagination etc. are in autoload, you get bunch of different errors. The link you gave is broken. Please update. (05-07-2015, 06:04 AM)zeos Wrote: hi Try anywhere PHP Code: $this->SomeController = new SomeController; |
Welcome Guest, Not a member yet? Register Sign In |