cake-php@googlegroups.com
[Top] [All Lists]

Re: MenuBuilder doesn't work with cakephp 2.0 (or 2.1)

Subject: Re: MenuBuilder doesn't work with cakephp 2.0 or 2.1
From: Rob
Date: Mon, 2 Apr 2012 07:24:05 -0700 PDT
You can push a new helper onto the helpers array (or any other array) like so:

$helpers[] = 'MenuBuilder.MenuBuilder';

This will keep all of the default helpers.  As the helper is not used until the View is rendered, you can add this code either to the beforeFilter or beforeRender methods.

On Monday, April 2, 2012 8:51:28 AM UTC-5, 750riderAce wrote:
Thanks to both Thomas :)
 
I found that I did download the wrong version... first I downloaded the version provided in the documentation (readme.md) which point to an old version (http://github.com/torifat/cake-menu_builber/zipball/master).
 
After download the right one everything worked.... the only additional thing that I also found that in addition to the Form and Html Helpers I had to include also the Session Helper in the AppController... otherwise the application gave me an error "Undefined property: View: $Session [CORE]\Cake\View|View.php line 804]"  ... including the Session helper fixed that... why?... no idea... somebody here (Rob) said that include those helpers was not neccesary and you can only set the MenuBuilder.MenuBuilder helper alone inside of the beforefilter() method.. but not idea how to do that to test... maybe Rob can chime again about that.
 
thanks

On Saturday, March 31, 2012 7:00:34 PM UTC-4, Thomas Verschuren wrote:
@750riderAce,
 
I'm not the same Thomas :)
But i had the same problem a minute ago.
 
Where you have "View ---> helpers ---> MenuBuilderHelper.php"
it should read "View ---> Helper ---> MenuBuilderHelper.php"
 
 

On Friday, March 30, 2012 5:02:21 PM UTC+2, 750riderAce wrote:
Thomas... could you please post waht exactly you have under each directory?

I'm using 2.1.1 and I did exactly the same setup that you did, but I'm still
getting the "Helper class MenuBuilderHelper could not be found" error

this is what I do have:
*app
  Plugin
    MenuBuilder
      Controller  ---> Component ---> MenuGathererComponent.php
      Test
      View ---> helpers ---> MenuBuilderHelper.php*
the line *CakePlugin::load('MenuBuilder');* was added to
*/app/config/bootstrap.php*

*The code in /app/Controller/Appcontroller.php*:

  *  var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');
plus the sample code under beforeFilter() method*
In my default.ctp the following code:

        *<div id="header">
            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>*

is this exactly what you have?

thanks
750riderAce


--
View this message in context: http://cakephp.1045679.n5.nabble.com/MenuBuilder-doesn-t-work-with-cakephp-2-0-or-2-1-tp5120624p5606930.html
Sent from the CakePHP mailing list archive at Nabble.com.


On Friday, March 30, 2012 5:02:21 PM UTC+2, 750riderAce wrote:
Thomas... could you please post waht exactly you have under each directory?

I'm using 2.1.1 and I did exactly the same setup that you did, but I'm still
getting the "Helper class MenuBuilderHelper could not be found" error

this is what I do have:
*app
  Plugin
    MenuBuilder
      Controller  ---> Component ---> MenuGathererComponent.php
      Test
      View ---> helpers ---> MenuBuilderHelper.php*
the line *CakePlugin::load('MenuBuilder');* was added to
*/app/config/bootstrap.php*

*The code in /app/Controller/Appcontroller.php*:

  *  var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');
plus the sample code under beforeFilter() method*
In my default.ctp the following code:

        *<div id="header">
            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>*

is this exactly what you have?

thanks
750riderAce


--
View this message in context: http://cakephp.1045679.n5.nabble.com/MenuBuilder-doesn-t-work-with-cakephp-2-0-or-2-1-tp5120624p5606930.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php
<Prev in Thread] Current Thread [Next in Thread>