![CakePHP-Development CakePHP-Development](/wp-content/uploads/2011/02/CakePHP-Development.jpg)
Have you ever use controller inside another controller(two controllers) in CakePHP ? If you are looking for the same thing, you are at the right place. I was working with CakePHP and i need to use a member info method of member controller in order controller(two controller in CakePHP). Instead of writing a code again in order controller, i searched for using controller inside controller. This can be easily done using App::import method of CakePHP.
App::import('Controller', 'Members'); class OrdersController extends AppController { var $Members; function beforeFilter() { $this->Members =& new MembersController; // Loads the class $this->Members->constructClasses(); // Loads the model associations, components, etc. of the Members controller } function index() { $this->Members->memberinfo(); } }
![](/wp-content/plugins/rax-email-subscription-and-social-media-links-after-posts/images/rax-rss.jpg)
![](/wp-content/plugins/rax-email-subscription-and-social-media-links-after-posts/images/rax-twitter.jpg)
![](/wp-content/plugins/rax-email-subscription-and-social-media-links-after-posts/images/rax-facebook.jpg)
![](/wp-content/plugins/rax-email-subscription-and-social-media-links-after-posts/images/rax-myspace.jpg)