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 always foreach ($user['Award'] as $award) that's why I left it outside the element. example: foreach ($user['Award'] as $award):?> <?php echo $this->element('users/block_awards'); ?> <?php endforeach; ?> OR foreach ($campaign['User']['Award'] as $award):?> <?php echo $this->element('users/block_awards'); ?> <?php endforeach; ?> But the $award inside the element comes back Undefined variable: award Am I missing something here? Cant be done this way? Dave --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---