What Fahmi said.

with

echo $this->renderElement('post_element', $post);

You are creating a variable in the element called $post_element (with
the value of $post)

The only reason its working for you at the moment is that you have
already created a variable in the view called $post:

foreach($posts as $post)

As all the variables share the same namespace, I would recommend:

echo $this->renderElement('post_element', $post);

and in the element, use $post_element to avoid confusion/overwriting
the $post in the view.


On Aug 21, 8:59 am, Fahmi Adib <[EMAIL PROTECTED]> wrote:
> i think you should use an array,
>
> array('post' => $post)
>
> On Aug 21, 2008, at 2:56 PM, rocket wrote:
>
>
>
> > hey guys im passing this:
>
> >    foreach($posts as $post)
> >            echo $this->renderElement('post_element', $post);
> >    }
>
> > but in my post_element i try to use
>
> > $post['title']
>
> > and it throws me this problem .... Notice:  Undefined variable:
>
> > Am i missing something? i'm real confused and have spent like 1 hour
> > trying to debug this...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to