I'm also dreaming of a

$this->isCalledByRequestAction

I made a ticket for this https://trac.cakephp.org/ticket/1013

olivvv

Gonçalo Marrafa wrote:
> Hi. 
>
> This thread is being very enlightening. I have a question though: doesn't
> an action always render a view (unless $autoRender is set to false)? Here's
> an example:
>
> in one_controller.php:
>
> function foo()
> {
>     $this->set('foo', $this->Foo->findAll());
>     $this->render('foo_view');
> }
>     
> *NOTE*: The render() part is optional, of course, but assuming $autoRender
> is not set to false it will implicitly render foo.thtml.
>
> in other_controller.php:
>
> function bar()
> {
>     $this->set('bar', $this->Bar->findAll());
>     $this->set('foo', $this->requestAction('/one/foo'));
> }
>
>
> Maybe i'm missing something but doesn't the call to '/one/foo' always
> render the view, even though requestAction is not asked to return the
> rendered view? Does foo()'s implementation have to contemplate the two
> distinct situations? Kinda like:
>
> function foo()
> {
>     $foo = $this->Foo->findAll();
>     if ($this->isCalledByRequestAction) {
>         return $foo;
>     }
>     else {
>         $this->render('foo_view');
>     }
> }
>
> Thanks in advance.
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to