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.
Options

struggling with highlighting correct current menu link

Hi,

I've been going around in circles with this one - and I just cannot get this to work, I'm hoping someone might be able to point me in the right direction…

I have a forum, setup for my web design students - and set the homepage to show the 'categories' - however, the menu link which is highlighted is 'discussions'?
This also stays the same when I do click the 'categories' link via the sidebar...

I've added a 'categories' link into the menu via :

        $this->Menu->AddLink('Categories', T('Categories'), '/categories/all');

hoping I could solve it somehow ~ but I have no idea what do :-(

the forum: webeyedea forum

Can anyone help me figure this one out? ~ any links, thoughts, suggestions would be greatly appreciated ;)

Tagged:

Comments

  • Options
    peregrineperegrine MVP
    edited July 2012

    maybe

    $this->Menu->AddLink('Categories', T('Categories'), '/categories/all/', FALSE, array('class' => 'Highlight'));

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited July 2012

    actually looking closer at it. It is logically still discussions with a category view.
    as opposed to inbox, activity which are not discussions.

    but maybe you could do some js that removes the class from the other links and adds
    Highlight class based on $Sender->SelfUrl.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Thanks, peregrine :)

    I've tried to figure out where the highlight class gets applied ~ and how I could change it to read the new page for starters, and then possibly to fix the problem… but not luck :(

    I'm not a developer and though I can handle working with PHP and jQuery, I don't feel confident enough to write a plugin, I've read up on this but seems to be too advanced for my little brain :P

    I tried your suggestion and it does highlight the link but alos the other link still - I think I will get rid of the CSS styling for the highlighting for now - maybe I need to try and solve this via jQuery, checking on page URL or something… not sure....

    Thanks for getting back to me though, really appreciate it ;)

  • Options

    you could add these to the default.php in the addmenu plugin just below

    public function Base_Render_Before($Sender) {

     if (($Sender->SelfUrl) == 'categories/all'){
          $Sender->Menu->HighlightRoute('/categories/all');
          }
     $Sender->Menu->AddLink('Categories', T('Categories'), '/categories/all'); 
    

    and it would probably solve your problem.

    its not that difficult.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    You could also consider adding your theme to the add-ons.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Thanks so much, peregrine :-)

    that worked perfectly ;) I really appreciate your help! :)

    And it did seem to be easy, for you ;) ~ if you're not primarily a coder it often is not quite as straight forward as a code expert like you might think :)
    Thanks again.

  • Options

    glad it worked.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.