We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts

    I find in the Wayfinder docs multiple chunks (Inners, Outers, Rows, etc.) are used to generate a navigation menu. I have only two chunks, though the menu works fine except that I am unable to figure out how to utilize both sides of the Zurb Foundation 5 TopBar Navigation menu.

    Would someone be willing to share tips, or show me the errors of my ways? The section class top bar section has a left and right section available. I would like one of my parent folders and all of its sub folders to appear in the left, and then have all of my remaining resources and parents appear in the right.

    Is there a way within my snippet call to say, use this resource with this left class, and use the other resources with the right class?
    Do I need a different tpl structure to make this work?

    Because the menu is responsive, I don't think I can create two completely separate navigation menus without then breaking the foundation aspect of the menu. I think what I would end up with in that case on mobile is two toggle menus, which wouldn't be good, and just take up additional space.

    May current call is:
    [[pdoMenu?
    &startId=`0`
    &level=`3`
    &outerTpl=`nav_main_outerTpl`
    &innerTpl=`nav_main_innerTpl`
    &outerClass=`top-bar`
    &innerClass=`dropdown`
    &parentClass=`has-dropdown`
    &hereClass=`active`
    ]]


    InnerTpl nav_main_innerTpl
    <ul[[+wf.classes]]>
        [[+wf.wrapper]]
    </ul>


    OuterTpl nav_main_outerTpl
    <nav [[+wf.classes]] data-topbar data-options="mobile_show_parent_link: true">
        <ul class="title-area">
            <!-- Title Area -->
            <li class="name"><p>PROPERTIES</p></li>
            <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
            <li class="toggle-topbar menu-icon">
                <a href="#"><span></span></a>
            </li>
        </ul>
     
        <section class="top-bar-section">
            <ul class="right">
                [[+wf.wrapper]]
            </ul>
        </section>
    </nav>



    So the desired markup for the top bar section would be something like this?

    <section class="top-bar-section">
    
            <ul class="left">
                [[+wf.wrapper]]<!--One of the main parent items here, plus any subparents or resources-->
            </ul>
    
            <ul class="right">
                [[+wf.wrapper]]<!--Remaining menu items here-->
            </ul>
        </section>
    
    </nav>
    • You could use two Wayfinder or pdoMenu snippet calls, and have them both use the same outer UL. Have the first snippet's outerTpl start the UL, but not close it. Have the second snippet's outerTpl not start the UL, but close it.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 19872
        • 1,078 Posts
        Thank you for tickling my brain on this. Interesting approach.

        I think I was actually missing my row information, even though the menu functions without it, so I am reviewing wayfinder docs now to refresh my memory. Problems with me is, Once I get something to work, I copy paste copy paste and I forgot the whole concept of how to build and what makes it work.:)
        • I learned about manipulating the outerTpl like that when I wanted to use the &displayStart property. You can use the &startItemTpl to start the UL and put the start item in an LI as usual, then use the outerTpl to close the UL, thus having the specified start (parent) as part of the menu. Just don't forget that [[+wf.wrapper]] placeholder in all the right places!
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 19872
            • 1,078 Posts
            Thanks Susan. I'll be give this a go later on today.
              • 19872
              • 1,078 Posts
              Yahoo Susan!

              I have this working for the most part. Your suggestion was spot on! I have my code along with some instructions that I would like to post, but I am having one little hiccup. I cannot seem to understand how to control which parents and resource get displayed on either the left.

              I have successfully removed certain items from the right side using &tplParents=`-6,-8,-21` (two of these are containers, with children I set to "hide from menu" in the manager, and the third is just a plain resource.

              On the left side, I thought I could specify the id number of the resources that I DO want to appear, but I am having issues.
              first I tried &tplParents=`6` which is the id for the top-level directory/container. But then, the two containers within show up side by side in the menu, and the top-level container doesn't appear in the menu at all.

              My hierarchy is:

              PROPERTIES (Main Container)

              FEATURED (Container)
              resource (the resources have "hide from menu checked in the manger"
              resource
              resource, etc.

              SOLD (Container)
              resource (the resources have "hide from menu checked in the manger"
              resource
              resource, etc.

              I'll keep after it. Hope to have complete solution soon.
                • 19872
                • 1,078 Posts
                Here are my notes for setting up pdoMenu to use both the left and right navigation sections of the Zurb Foundation 5 Top-bar


                Kudos to Susan for her tips!

                Step One:
                Create one chunk to contain the top (opening portion of the top-bar navigation), the 2 pdoMenu snippet calls we will build later, and the closing portion of the top-bar navigation menu.

                I'm naming this chunk navigationSectionSplit. This is the chunk that goes on the template pages.

                Important: With Foundation, if you choose not to put anything in the "Title Area", you must just leave the li blank. If you comment out the li area, the menu will not function properly on small or mobile view.

                Chunk for the navigation: navigationSectionSplit
                Insert the following code:

                <!--opening tags-->
                <nav class="top-bar" data-topbar data-options="mobile_show_parent_link: true">
                    <ul class="title-area">
                        <!-- Title Area -->
                        <!--<li class="name"><p>Title Here If You Like</p></li>-->
                        <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
                        <li class="toggle-topbar menu-icon">
                            <a href="#"><span></span></a>
                        </li>
                    </ul>
                    
                <!-- Right Nav Section -->
                    <section class="top-bar-section">
                
                <!--Your 2 pdoMenu snippet calls will go below here-->
                
                
                <!--Your 2 pdoMenu snippet calls will go above here-->
                
                <!--closing tags-->
                    </section>
                </nav>


                Step Two:
                Create an outer chunk. You only need one.
                Name it: navOuterTpl
                Call it in both pdoMenu snippet calls like so: &tplOuter=`navOuterTpl`
                Enter the following in this chunk.

                <ul [[+wf.classes]]>
                [[+wf.wrapper]]
                </ul>
                


                To differentiate the instances they'll each receive a class.
                The top pdoMenu snippet call will get the class .right, like so: $&outerClass=`right`
                The bottom pdoMenu snippet call will get the class .left, like so: $&outerClass=`left`
                Load order I think is important. Right should be above left. Thus the top pdoMenu snippet call gets the class of right, and the bottom pdoMenu gets the class of left.

                Step Three:
                Create another chunk for the innerTpl
                Name it navInnerTpl and call it in both snippet calls like so: &tplInner=`navInnerTpl`
                Enter this code in the chunk.
                <ul [[+wf.classes]]>
                [[+wf.wrapper]]
                </ul>
                


                CSS Classes will need to be applied so that top-bar can style the nav menu if the contents are part of a dropdown.
                To handle this, we add &parentClass=`has-dropdown` to both pdoSnippet calls so top-bar can style it properly.

                To further the styling, we need to let top-bar know how to style any dropdown items.
                Thus, we add &innerClass=`dropdown` to both pdoMenu snippet calls

                Step Four:
                Create the chunk to handle the ITEMS. Lets just call it navRowTpl.
                Enter the following in the chunk.

                <li[[+wf.id]][[+wf.classes]]>
                <a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>
                [[+wf.wrapper]]
                </li>
                


                Call this chunk in both pdoMenu snippet calls like so: &tpl=`navRowTpl`

                Some final css classes we need to add are: .active, .dropdown, and .has-dropdown.
                Add these to both pdoMenu snippet calls:
                &hereClass=`active`
                &innerClass=`dropdown`
                &parentClass=`has-dropdown`

                Below is my final chunk code for navigationSectionSplit along with some of the foundation markup for the columns. At this point, you can go crazy styling the navigation area and even top-bar itself.

                I know there is much more that can be utilized with pdoMenu to further control and organize the menu. Much to learn still.

                In my scenario, I wanted everything except for a couple of parent items and one master resource container to appear on the RIGHT. (6 contains, 8 & 21—which were also containers)
                On the LEFT side, I wanted the master container 6 and all of it's contents. I solved this by using 0 (everything) and then omitted 3 resources using the &resources and minus signs in front of the id numbers. This took quite a bit of trial and error, and I'm still not convinced it's the best or correct method to do it, but it does appear to be working OK...

                Final chunk code for navigationSectionSplit
                Call this chunk on your template.
                  <div class="row">
                    <div class="large-12 columns">
                    
                    <nav class="top-bar" data-topbar data-options="mobile_show_parent_link: true">
                    <ul class="title-area">
                        <!-- Title Area -->
                        <li class="name"></li>
                        <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
                        <li class="toggle-topbar menu-icon">
                            <a href="#"><span></span></a>
                        </li>
                    </ul>
                    
                <!-- Right Nav Section -->
                    <section class="top-bar-section">
                    
                [[pdoMenu?
                &parents=`0,-8,-21`
                &resources=`-6`
                &level=`3`
                &tplOuter=`navOuterTpl`
                &tplInner=`navInnerTpl`
                &tpl=`navRowTpl`
                &outerClass=`right`
                &innerClass=`dropdown`
                &parentClass=`has-dropdown`
                &hereClass=`active`
                ]]
                
                [[pdoMenu?
                &parents=`0`
                &resources=`-1,-4,-5`
                &level=`3`
                &tplOuter=`navOuterTpl`
                &tplInner=`navInnerTpl`
                &tpl=`navRowTpl`
                &outerClass=`left`
                &innerClass=`dropdown`
                &parentClass=`has-dropdown`
                &hereClass=`active`
                ]]
                
                    </section>
                </nav>
                </div>
                </div>
                


                If anyone has any improvements or suggestions, please do share. [ed. note: mmcgee last edited this post 9 years, 1 month ago.]