call one of the method from another class - 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: call one of the method from another class (/showthread.php?tid=57874) |
call one of the method from another class - El Forum - 04-21-2013 [eluser]Uresh Patel[/eluser] Respected, I have two controllers.I want to call one of the method from one class. Below both class are different controller files E.g: Code: class User extends CI_Controller { call one of the method from another class - El Forum - 04-22-2013 [eluser]Otemu[/eluser] Hi, The best way to do something like this is either create a library or helper. Also check out this excellent article CodeIgniter Base Classes: Keeping it DRY. Hope that helps call one of the method from another class - El Forum - 04-22-2013 [eluser]Uresh Patel[/eluser] HI, Thank you for reply.But i am looking forward to have a proper solution.i have foggy idea but not clear with it. We can create instance or can we do like language "C++" using friend function using that access modifier ????? [quote author="Otemu" date="1366624431"]Hi, The best way to do something like this is either create a library or helper. Also check out this excellent article CodeIgniter Base Classes: Keeping it DRY. Hope that helps[/quote] call one of the method from another class - El Forum - 04-22-2013 [eluser]jairoh_[/eluser] do not use the controller. the proper way is to use model or library or helper. it depends. tell us the purpose of the add function. |