How do I call one Controller\'s methods from a different Controller?

Answer

Short answer: You don't

Wrong answer: Use the $CI = get_instance() trick.

Long answer: You shouldn't actually be trying to do this. It implies that your design isn't quite right, but on the upside it's quite easy to re-engineer the relevant bits when you first discover this problem.

It's likely that the method you want to call should simply be relocated - this might mean moving it into a helper, library, model or your MY_Controller - where it can be accessed by any number of controllers.

All CODEIGNITER Questions

Ask your interview questions on codeigniter

Write Your comment or Questions if you want the answers on codeigniter from codeigniter Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---