![]() |
controller extends controller, same for models - 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: controller extends controller, same for models (/showthread.php?tid=57203) |
controller extends controller, same for models - El Forum - 02-25-2013 [eluser]UnknownPlayer[/eluser] Hi, can controller extend another controller ? Example: Code: class Social extends User { where user is controller . And same question for models ? controller extends controller, same for models - El Forum - 02-25-2013 [eluser]Aken[/eluser] Yes, but CI does not include any autoloading functionality, so you'll need to include/require the file or set up your own autoloader. controller extends controller, same for models - El Forum - 02-26-2013 [eluser]UnknownPlayer[/eluser] You mean MY_Controller ? I have that, but i don't wanna include User controller in every page. controller extends controller, same for models - El Forum - 02-26-2013 [eluser]boltsabre[/eluser] This might help you: http://philsturgeon.co.uk/blog/2010/02/CodeIgniter-base-Classes-Keeping-it-DRY Else if just wanted a handful of your controllers to extend the user controller, all you have do is include your "user" controller file in the controller/s you want to extend user like this: Code: <?php controller extends controller, same for models - El Forum - 02-27-2013 [eluser]UnknownPlayer[/eluser] Thanks, this is what i need. |