We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4839
    • 1 Posts
    This is my first week with Modx. I have a site which is like the ModxHost template with a menu built with WayFinder. But I want to show a static menu above the sections. So if the menu is

    Home
    Documents
    Users Guide
    Developers Guide
    Contributors Guide
    Contact

    So I want the top menu to show with a section header for the guides, so if you selected Documents it would look like this.

    Home | Documents | Contact
    Users Guide ~ Developers Guide ~ Contributors Guide

    So I get this to work by adding the following line to the template...
    <div id="sectionMenu"> [[Wayfinder? &hideSubMenus=`1` &level=`0` &firstClass=`first` &hereClass=`currentSection`]] </div>

    Which works fine except that when you click on "Users guide" the submenu disappears because the active page is now one level down. I want the section menu to be show when you browse each guide. I can make it work by assigning a template to each page in Documents with &level=`42` where 42 is the page of the Documents.

    Is there a way to keep that section menu sticky as you click through the subsections?

    Thanks,

    Chad
      • 14412
      • 74 Posts
      You should be using Wayfinder’s &startId parameter. assuming that your section menus are folders right below root, you can use:

      [[Wayfinder?&startId=`0` &hideSubMenus=`1` &level=`2` &firstClass=`first` &hereClass=`currentSection`]]

      from what I gather, the &level parameter indicates how many levels the menu should have, not the id of a parent document.

      Hope this helps!

      Regards, JP

        Got Music? Try XSPFjukebox - Skinnable MODx Media Player
        • 16312
        • 3 Posts
        There may be a better answer for your application. My template has tabs across the top and contextual items on the left side. I needed something to highlight the tabs correctly while in submenus as well as keeping the submenu/contextual options correct. I haven’t checked to see if I can prune the parameters further. There may be some duplication, but I also have the situation that not all top-level pages (for the tabs) have child documents.

        [[Wayfinder?startId=`0` &hereTpl=`a06hereTpl` &activeParentRowTpl=`a06hereTpl`  &parentRowTpl=`a06Parent` 
        &parentRowHereTpl=`a06hereTpl`]]
        
        The chunks are:
        a06heretpl:
        <li id="current"><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></li>
        
        a06parent:
        <li><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></li>
        


        (I’m using a template based on the Andreas06 template by Andreas Viklund.) I didn’t want any submenus in the tabs, so there are no [+wf.wrapper+] placeholders in either chunk. The one trick here is that WayFinder doesn’t find children (and therefore use the ParentRow templates) unless your level setting includes any child pages (such as those linked by sub-menus). The side-effect of this is that if the level setting is too small, there won’t be any top-level highlighting when accessing a more distant child page.

        For the submenu, I use the following:
        [[Wayfinder?startId=`0` &rowTpl=`a06empty` &innerRowTpl=`a06row` &outerTpl=`a06blank`
         &activeParentRowTpl=`a06blank` &parentRowTpl=`a06empty`]]
        
        The chunks here are:
        a06empty:
         
        
        a06blank:
        [+wf.wrapper+]
        
        a06row:
        <a class="nav" href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a><br class="hide" />[+wf.wrapper+]


        a06empty contains a single space. If a template chunk is completely empty, WayFinder uses its default value. The key point here is that except for the active parent row, there are no placeholders for menu items. This prunes other branches. The submenu is generated from the inner row template rather than rowtpl because top-level menu items with no children will be populated with rowTpl.