morning mate,

whenever you need a variable to be available within an element you
have to pass it as an argument when calling the renderElement
function.

http://manual.cakephp.org/chapter/views

On 30/09/06, michael234 <[EMAIL PROTECTED]> wrote:
>
> In my controller I have...
>  function index()
>                 {
>                    return $this->set('data', $this->Enquiry->findAll());
>                 }
>
> In my view (template/index.thtml) I have..
> <?php echo $this->renderElement('index',
>                                         
> array('data'=>$this->requestAction('/enquiries/index'))); ?>
>
> Finally in elements/index.thtml I call the data like this..
> ...
> <?php foreach ($data as $output): ?>
>                <?php echo $output['Enquiry']['id']?> and so on...
> ...
>
> However when I view /template..unsurprisingly I get the error..
> Warning: Invalid argument supplied for foreach() in..
>
> How do I make the variable $data available to the element index?
>
> Thanks,
> Michael.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to