Creating common controllers - 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: Creating common controllers (/showthread.php?tid=59486) |
Creating common controllers - El Forum - 10-11-2013 [eluser]patilshailesh[/eluser] Dear All I need to create a common controllers (kind of repositories) which access their models and use in different application. For eg: I have 1 main set of controllers and models. controller1.php: I have method which returns user_id In my app 1: I will use same controller1.php but, with different behavior. it will return user_id, Contact full name In my app 2: I will use same controller1.php but, in this case, it will return user_id, contact_id, contact name and date of birth as well. So, base class and database interaction may remain same, but i need to extend the controllers and models. How can i achieve this? thank you in advance Creating common controllers - El Forum - 10-14-2013 [eluser]patilshailesh[/eluser] any help please. or if i am in wrong direction, plz correct me. thanks Creating common controllers - El Forum - 10-14-2013 [eluser]a_h_abid[/eluser] Maybe this will help you... CodeIgniter-Base-Classes-Keeping-it-DRY Creating common controllers - El Forum - 10-14-2013 [eluser]patilshailesh[/eluser] Dear thanks for your reply. Very much near to what i am trying to acheive. My goal is to have common controller. My folder structure will be: Project MainCI application controllers user.php models userm.php App1 application controllers user.php models userm.php App2 application controllers user.php models userm.php I want App1 user controller should be inherited from MainCI user controller. Functionality will be almost same. In case i need more, i can add in App1 or App2 controller function. Is it possible? how it can be done? Creating common controllers - El Forum - 10-15-2013 [eluser]a_h_abid[/eluser] Well not possible with current way. However there is an extension to share common controllers and stuffs throughout applications. XHMVC cross modular extension https://bitbucket.org/xperez/codeigniter-cross-modular-extensions-xhmvc I've never tried it so can't say if it works or not. |