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.

Adding or editing menu items (can't seem to use default.master file) [RESOLVED]

whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP
edited January 2016 in Vanilla 2.0 - 2.8

Thanks very much for this theme, which I know my mobile users are going to be very grateful for.

I have some custom menu items, which I add via default.master.tpl to SiteMenu, but if I add a default.master file to the minusbaseline theme the contents of the Hamburger menu no longer appear.

Any tips as to how I could go about editing the SiteMenu?

Thanks.

Comments

  • hgtonighthgtonight ∞ · New Moderator

    What contents are you adding?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

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

    Just a couple of links to custom pages, which I have done via default.master on my site, but can't do with this theme, as far as I can tell.

    This is how the code looks in my default.master file on my site atm:

     <li class="Index"> <a href="http://www.whu606.com/predictor">Predictor</a> </li>
              <li class="Index">
            <a href="#">In Memoriam</a>
            <ul class="index">
              <li><a href="#">Moorowasmagic</a></li>
              <li><a href="#">Hammerman69</a></li>
    
              <li>  <a href="#">SledgeHammer</a> </li>
    
              </li>
    
  • hgtonighthgtonight ∞ · New Moderator

    Are you doing some type of parsing on the empty links?

    This theme looks like it is doing to parsing of the hash of URLs. That could be your issue.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

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

    @hgtonight

    The issue for me is that the theme doesn't contain a default.master file, and if I add one, it breaks the hamburger style display of the categories etc.

    In my current theme, I simply added the code above to my default.master.

    So, I either need to find out how to add a default.master without breaking the theme, or to find a way to edit the links in SiteTile without using a default.master file.

    Thanks for looking!

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Have you tried adding the link using a plugin like Index plugin ? You also can add links into the theme hooks file , below I added buttons to the menu via the themehooks of my mobile theme.
    example:

    public function DiscussionController_Render_Before($Sender) {
          $this->_AddButton($Sender, 'Discussion');
    $this->_AddButton($Sender, 'ProfileLink');
    
       }
    
     private function _AddButton($Sender, $ButtonType) {
          if (is_object($Sender->Menu)) {
             if ($ButtonType == 'Discussion')
                $Sender->Menu->AddLink('NewDiscussion', Img('themes/mobile/design/images/new.png', array('alt' => T('New Discussion'))), '/post/discussion'.(array_key_exists('CategoryID', $Sender->Data) ? '/'.$Sender->Data['CategoryID'] : ''), array('Garden.SignIn.Allow'), array('class' => 'NewDiscussion'));
             elseif ($ButtonType == 'Conversation')
                $Sender->Menu->AddLink('NewConversation', Img('themes/mobile/design/images/new.png', array('alt' => T('New Conversation'))), '/messages/add', '', array('class' => 'NewConversation'));
    
    elseif ($ButtonType == 'ProfileLink')
    $photo = UserPhoto(Gdn::Session()->User);           
     $Sender->Menu->AddLink('User',  $photo,  '/profile/{UserID}/{Username}',array('Garden.SignIn.Allow'), array('class' => 'UserNotifications'));
          }
       }
    
  • hgtonighthgtonight ∞ · New Moderator

    @whu606 said:
    @hgtonight

    The issue for me is that the theme doesn't contain a default.master file, and if I add one, it breaks the hamburger style display of the categories etc.

    In my current theme, I simply added the code above to my default.master.

    So, I either need to find out how to add a default.master without breaking the theme, or to find a way to edit the links in SiteTile without using a default.master file.

    Thanks for looking!

    This is interesting. I copied /applications/dashboard/views/default.master.tpl into /themes/minusbaseline/views/default.master.tpl on a fresh 2.2 install and everything still worked but a new notice showed up.

    Notice preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\Users\zdoll\projects\vanilla\library\vendors\Smarty-2.6.25\libs\Smarty_Compiler.class.php line 270

    This is no big deal as it is a notice. I was then able to add the markup you posted and the hamburger button worked.

    I am not sure what is going on. What default.master.tpl file did you use as a template?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

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

    Thanks @Vrijvlinder.

    OK, @hgtonight , well, if it can be done, I must be doing something wrong!

    I did copy over the file you mentioned.

    I'll start again from clean and see how I get on.

    Thanks for looking at this.

    Will report back.

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

    Thanks, @hgtonight

    On a clean install it works as expected, so I'll have a fiddle and try to work out what was causing the issue.

    If I find out, I'll post back here.

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

    OK

    Put that one down to gremlins, I reckon.

    Installed a clean Vanilla 2.2, and as @hgtonight said, all was good with adding a default.master (on a local machine.)

    Then added minus baseline theme to a hosted test forum, and the behaviour from yesterday wasn't repeated...

    No idea what caused it, but thanks for taking a look, and thanks to @Bleistivt for the theme.

Sign In or Register to comment.