Element question

2009-09-22 Thread Dave Maharaj :: WidePixels.com
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

Re: Element question

2009-09-22 Thread brian
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,

RE: Element question

2009-09-22 Thread Dave Maharaj :: WidePixels.com
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

element question newbie

2008-05-18 Thread .
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

Re: element question newbie

2008-05-18 Thread .
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