Extending a controller? |
[eluser]mvdg27[/eluser]
Hi guys, I'm wondering if it is possible to extend a controller? I'm thinking something like this: I have a controller 'website' with a bunch of functionality. Now I would want to have something like 'website_extra', with some extra functionality and some changed functionality, but mainly the same stuff as 'website' .. it doesn't make sense to copy the everything to a new controller, does it? Is extending a controller possible within the CI framework? Thanks! Michiel
[eluser]Greg Aker[/eluser]
Yes. http://ellislab.com/codeigniter/user-gui...aries.html [/url] Also search the forums for "MY_Controller" -greg
[eluser]mvdg27[/eluser]
Hi Greg, Thanks for your reply! I think the link you gave me applies just to libraries and I don't think that's what I'm after. I would actually want to extend my controller class as one would normally do in PHP. I've searched the forum for MY_Controller, and found some threads, but still confused about how it works exactly. Could you help me a bit on the way on this one? How could I use MY_Controller to extend 'website' with 'website_extra'? Can I use this way for different controllers as well (e.g. 'simplenews' and 'advancednews'). Thanks again! -Michiel
[eluser]sophistry[/eluser]
Forget MY_Controller.php - it's for changing the behavior of the Controller Class itself. You want something like this (normal class extension): Website.php Code: <?php Website_extra.php Code: <?php
|
Welcome Guest, Not a member yet? Register Sign In |