Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 2.6.1 is here with critical security patches. One of them has been publicly disclosed.
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

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

This discussion is related to the MinusBaseline addon.
whu606whu606 I'm not a SuperHero; I just like wearing tights... Moderator
edited January 2016 in Vanilla 2.0 - 2.3

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

    @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'));
          }
       }
    
    Bleistivt
  • 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.

    whu606Bleistivt
  • whu606whu606 I'm not a SuperHero; I just like wearing tights... Moderator
    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... Moderator

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

    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.

    hgtonightBleistivt
Sign In or Register to comment.