Tuesday, July 17, 2012

Re: how to call one function of one contoller into another controller

I just know how to solve problem easily doesn't matter how

If you really worried about the logic then put a great code here and i assure i will also use your code
So please guide me also.

On Tuesday, July 17, 2012 4:54:54 PM UTC+5:30, AD7six wrote:


On Tuesday, 17 July 2012 12:59:59 UTC+2, Bharat Maheshwari wrote:
Not a big issue you can simply use requestaction just like in a cpt file

Suppose you have a function in user controller named : - getUserDetail($user_id)

and now you want to use this function in post controller
then simply write

$userDetail=$this->requestaction('/users/getUserDetail/'.$userId);

That is a great example of misusing request Action instead of putting the logic in a method in your user model - and calling it directly.

AD

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: