It should work, you have to set requestaction equal to a variable if
you want the returned output, this is how I use it:
$results = $this->requestAction('/controller/method');
Also, make sure that your method ends with:
return($datayouwanttoreturn);
You can also define the function in your method and setup a relation
in your model (or at least a Uses relation). This is probably the
better solution if you don't want the user to have direct access to
the method your are calling (with request action, the user could put
the path directly in the address bar and use it). When you have this
relation setup you call the method like this:
$results = $this->WhateverYourModelIs->WhateverTheModelYourCallingIs-
>thefunctionyouwanttocall($passeddata);
Dave
On Jan 21, 9:19 am, MonkeyGirl <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I'm trying to run another controller's unrelated method from within
> the method of the page being accessed, in the hope I might be able to
> get all the variables it's setting to avoid code duplication. It looks
> like requestAction can do this very thing, but I can't seem to get it
> to output anything, even with array('return' => TRUE) as a second
> parameter.
>
> I've looked at previous threads about the topic here, and although one
> seemed to make reference to the answer I was looking for, it resided
> on that Wiki that's no longer up.
>
> Is there any way to execute a different controller's different method
> from within the relevant controller's relevant method? Am I on the
> right track with how I'm going about it?
>
> Thanks!
> Zoe.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---