On 09/27/2009 04:31 PM, brian wrote:
> The comment for setAction() says that it "Internally redirects one
> action to another." However, it doesn't really *redirect* so much as
> simply call the action using call_user_func_array(). It amounts to
> about the same thing, more or less, but there's something to keep in
> mind:
>
> public function someAction()
> {
>       $this->setAction(
>               'error',
>               'This error message should display.',
>               array('foo' =>  'bar')
>       );
> }
>
> private function error($msg = '', $data = array())
> {
>       $this->set(compact('msg', 'data'));
> }
>
> This will display the error view *but* the $viewVars will not be set.
> In order to make this work, set the access to the called action to
> protected (or public, obviously), because setAction() is defined in
> the parent class (Controller). If you absolutely need it to be
> private, you'll have to override setAction() in your own controller.
>    
Don't know if I understand "exactly" your problem, but maybe an 
auxiliary function should do the job:

public function someAction() {
     $this->setVars('varA', 'varB', 'varN');
     $this->setAction('error');
}

private function error() {
     $this->set('vars', $this->getVars());
}

Hope this helps...

MARTIN


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to