I also did that, returns also 'Undefined variable'.
However I found a way, I added the following function to the
controller:
function beforeRender() {
parent::beforeRender();
$this->set('categories', $this->Category->find('all',
array('recursive'=>0)));
}
This works now as expected, however I do not really understand why it
didn't worked in the first place.
greeting, Richard
On 3 sep, 11:58, Anja Liebermann
<anja.lieberm...@schauinslandreisen.de> wrote:
> And how about
> var_dump($categories);
> In the view?
>
> Anja
>
> -----Ursprüngliche Nachricht-----
> Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im Auftrag von Richard
> Gesendet: Freitag, 3. September 2010 09:25
> An: CakePHP
> Betreff: Re: Undefined variable in view
>
> Hello Milos, thanks for you reply! If I define the variable in the controller as follows it states again that it's undefined in the view.
>
> $this->set('categories', 'TestValue');
>
> When I echo the variable in the controller everything looks alright:
> var_dump($this->viewVars['categories']);
>
> However it does not pass all of the viewVars for some reason to the view.
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> 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+unsubscribe@googlegroups.com For more options, visit this group
> cake-php+athttp://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment