-1

I have a custom helper (MessageHelper) in which I need access to another custom helper (IncentiveHelper). I've followed the format described in the docs, but I'm getting this error:

Undefined property: MessageHelper::$Incentive [APP/views/helpers/message.php, line 21]

Here's the relevant chunk of code. To my eye, it looks virtually identical to that in the 1.3 docs:

class MessageHelper extends AppHelper {
  public $helpers = array( 'Incentive' );

  public function rebates( $rebates ) {
    debug( $this->Incentive ); exit;
  }
}

The files are named and stored according to convention as app/views/helpers/message.php and app/views/helpers/incentive.php. On a whim, I did try including a core helper (HtmlHelper) instead, but that failed the same way.

What am I missing here? Is there something obvious that I'm just not seeing? Seems like there must be, but my eyes are starting to cross. Any nudge in the right direction would be much appreciated.

4

1 回答 1

0

我不是 cakephp 方面的专家,但我认为您可能正在寻找类似http://php.net/manual/en/language.namespaces.importing.php的东西

于 2012-09-26T11:45:24.263 回答