![]() |
I want create a Typical Controller and extends all controller from it, but CI don't find - 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: I want create a Typical Controller and extends all controller from it, but CI don't find (/showthread.php?tid=26957) Pages:
1
2
|
I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-12-2010 [eluser]Zorancho[/eluser] First thing, create new file at application/libraries folder and name it MY_Controller.php If you want to change the prefix MY, go to application/config/config.php file, on line 106 you got this: $config['subclass_prefix'] = 'MY_'; which means you can add your own subclass prefix. You need this when you extend core classes from CI. In MY(or whatever your prefix is)_Controller.php file, create new class. Code: //This is parent of all of your controllers from application/controllers folder. Then in your application/controllers/home.php Code: class Home extends Front_Controller In your application/controllers/admin/dashboard.php Code: class Dashboard extends Admin_Controller I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-13-2010 [eluser]Kaosland[/eluser] Thanks It's a good exemple. But a don't understand why, i have insert a line befort _autoload then work now.!!!!! But thanks again I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-13-2010 [eluser]Zorancho[/eluser] Why would you want to autoload controllers? That's done in the Routing of CI according to the URL you are executing through the browser. In MVC structure such as CI, usually models could be auto loaded, but it is not necessary at all and auto loading controllers is a bad practice i think, someone please correct me if i am wrong. I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-13-2010 [eluser]Kaosland[/eluser] Because I have create a ControlerFront with multi lib that i had create for create&management;Background of the Front;. So i can recopy the code then what POO exits. My other controler extend from Controlerfront. SO the pobleme it'ss next when CI load controlle thenews extend controlerFont, CI don't find controlerFont. Thanks for you help. I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-14-2010 [eluser]Zorancho[/eluser] Then, please copy the error(s) you are getting and the code causing the errors, cause like this i really cannot help you. I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-14-2010 [eluser]Kaosland[/eluser] I solve error I have intoduce a blank line befor Code: //blank i don't understand why but work I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-15-2010 [eluser]Phil Sturgeon[/eluser] I wrote an article to explain how to do this properly. nothing new, but clearer than the random tit-bits posted on various topics. http://philsturgeon.co.uk/news/2010/02/CodeIgniter-Base-Classes-Keeping-it-DRY I want create a Typical Controller and extends all controller from it, but CI don't find - El Forum - 02-15-2010 [eluser]Kaosland[/eluser] Thanks for you. It's a good sum up. |