Scope confusion?

The following works:

<?php
function printUpDown($html_helper)
{
    echo $html_helper->image('up.gif');
    echo $html_helper->image('down.gif');
}
?>

<p><?php printUpDown($html) ?></p>

Geoff wrote:
> When i use the html helper in an element it works fine if it is called
> directly. If, however, it is called from a function in the element, it
> does not work: "Notice: Undefined variable: html in".
>
> For example, this doesn't work:
>
> <?php
> function printUpDown() {
>       echo $html->image('up.gif');
>       echo $html->image('down.gif');
> }
> ?>
> <p>
> <?php printUpDown() ?>
> </p>
>
> But this does:
>
> <p>
> <?php echo $html->image('down.gif') ?>
> </p>
>
> any ideas?
>
>
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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