Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

add a menu item - need some help on this -

Hi - using the latest Vanilla2 - I'm trying to add a menu item (like the "home") and have used what I've found on this forum by adding this code $this->Menu->AddLink('Home', T('Home'), '/'); to the themes/mycustomtheme/views/default.master.php.

Have tried many times with this - deleting the cache .ini and compiled files in Smarty folder - no go. When I add this code to the default.master.php file of "Enigma Green" theme - I see the link! I don't see it when adding to the default Vanilla or any of the other themes.

What is the magic to get this to work?

I'd like this to be in the front of all the menus, which means the plugin of AddMenuItems won't work for this task.
Thank you

Answers

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited January 2013

    you can use addmenu item and change the order of the links in your config.php

    $Configuration['Garden']['Menu']['Sort']= array('Home', 'Dashboard', 'Discussions', 'Questions', 'Activity', 'Applicants', 'Conversations', 'User' , 'SignIn');

    if you add the link via the default.master.php you must make sure it is added in the right spot and also if it is added so it only shows after logged in, you won't see it unless you are logged in. What themes did you use that this did not work?

    GaryFunk
  • Somehow I just got this to work but can't believe the tangle! Does it have to be all these things (or in my case, it looks like it does have to be all 3 things:)
    1. Add the AddMenuItem Plugin
    2. add $this->Menu->AddLink('Home', T('Home'), '/'); to theme/mytheme/views/default.master.php (and is that a period after 'default'?)
    3. to change the link order, use the $Configuration line you showed me above.

    With all those 3 in my custom theme, they're working - altho I thought it could be done without the plugin.

    Thanks for any info and at least it's working now!

    vrijvlinder
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I guess,That is the magic to get this to work :)

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @jrf

    You can just use steps 2 and 3, without the plugin.

  • Thanks for this, when I have a moment I'm going to pull the plug on that plugin. I know it's redundant - probably caching issue or some conflict, but for now in the spirit of 'if it ain't broke don't fix it' I'm keeping it all there as doing only #2 and #3 as above didn't work - as I learn more about Vanilla behind the scenes I'll post what the issue is.

Sign In or Register to comment.