I am trying to use an element inside a foreach loop.
I have the same code in 3 places and figured it would be easier to put the
duplicated code into an element and just render the 1 where needed.
I put the element inside the foreach because the $award is is different how
it is obtained, its not
That's because the element relies on $viewVars. $award is outside the
element's scope because you created it in your view. At least, I
believe that's the case. Do this instead:
echo $this-element('users/block_awards', array('award' = $award));
That should pass your var to the element.
On Tue,
Right on thanks.
Found it too after doing a little digging in the cookbook.
Thanks again,
Dave
-Original Message-
From: brian [mailto:bally.z...@gmail.com]
Sent: September-22-09 10:44 PM
To: cake-php@googlegroups.com
Subject: Re: Element question
That's because the element relies
in cake 1.2, according to the API, it says
View::element ( $ *name*, $ *params* = array()
but when I do this:
echo $this-element('comments/add', array(data1='a'));
I cannot do echo $data1
--~--~-~--~~~---~--~~
You received this message because
please ignore. i looked in the wrong file
On Sun, May 18, 2008 at 10:37 PM, . [EMAIL PROTECTED] wrote:
in cake 1.2, according to the API, it says
View::element ( $ *name*, $ *params* = array()
but when I do this:
echo $this-element('comments/add', array(data1='a'));
I