Friday, April 3, 2009

weird problem with helpers

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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: