I have an several helpers that do what you're doing below (one is for
pagination). However, I am also using 1.1. The manual does it the same
way (I think this also covers 1.2).
One thing to note, while you do need to use the $helpers array in the
subclass to utilize the helper internally, you also need to include the
Html helper in your controller. This initializes the helper for use in
the views and other helpers as well.
Did I say helper enough times in that sentence? Yeesh.
Good luck,
Fred
smacks wrote:
> Hi guys,
>
> I've got a weird problem with including the HtmlHelper in a custom
> helper.
> Well, maybe I just can't see what I did wrong, but ...
>
> This is my custom helper:
>
> class MenuHelper extends Helper
> {
> var $helpers = array('Html');
>
> function createMenuList($data,$check)
> {
> return $this->Html->link('test');
> }
> }
>
> Basicly it's supposed to create the navigation for my project.
> I stripped out any unimportant code for you.
>
> But what I get is:
>
> Notice (8): Undefined property: MenuHelper::$Html [APP\views\helpers
> \menu.php, line 21]
> Fatal error: Call to a member function link() on a non-object in ...
> \app\views\helpers\menu.php on line 21
>
> So, what's that? I tried to search Google and this Group, but I
> haven't found a solution.
> I found something in the "Tempdocs" for Cake 1.2, but I can't see how
> this might be
> different from what I'm doing?!?
>
> http://tempdocs.cakephp.org/#TOC104199
>
> Any help appreciated. Thanks in advance!
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---