Why are you adding this Code39 to your $helpers array inside the
method? When your controller loads BarcodeHelper, it won't be properly
registered.

On Fri, Apr 3, 2009 at 8:23 AM, Ernesto <e.fanz...@gmail.com> wrote:
>
> Hello.
>
> i'm having some trouble with custom helpers.
>
> This code (same as Bakery) works:
>
> <?php
>        class BarcodeHelper extends AppHelper {
>
>                var $helpers = array('Code39');
>
>                function Code39($string) {
>
>                        print_r($this->helpers);
>                        $codedData = $this->Code39->encode($string);
>
>                }
>
>        }
> ?>
>
> this doesn't
>
> <?php
>        class BarcodeHelper extends AppHelper {
>
>                function Code39($string) {
>
>                        print_r($this->helpers);
>                        $this->helpers[] = 'Code39';
>                        $codedData = $this->Code39->encode($string);
>
>                }
>
>        }
> ?>
>
> the PHP error output is "Undefined property: BarcodeHelper::$Code39"
>
> in both cases the "print_r($this->helpers)" command outputs the same
> thing:
>
> Array( [0] = "Code39" )
>
> Why the second option isn't working?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to