We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44353
    • 10 Posts
    First let me apologize if this has been covered elsewhere. I've searched and read all I can find and seem to be up against a wall here. I'm relatively new to Modx and am trying to fully integrate a custom bootstrap menu.

    The basic problem seems to be that wayfinder assigns the ParentRowTpl to any document that is a container and has children. That works fine for the first two menu levels, but if the second level also has children I need to add the dropdown-submenu class to the li to get bootstrap dropdowns to work. Essentially I need for the children of first level that have children to use another template than the ParentRowTpl default.

    Am I just missing something simple here?? I manually added a comment to the template call I need to change:

    <!-- tpl.Wayfinder.row -->
    <li >
        <a href="contact" >Contact Us</a>
    	
    </li>
    
    <!-- tpl.Wayfinder.row.parent -->
    <li class="last dropdown">
        <div class="btn-group"><a href="blog/" title="Blog" class="btn"  >
    		Blog
    		
    	</a>
        <button class="btn dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
      </button>
    	<ul class="dropdown-menu">
    		<!-- tpl.Wayfinder.inner -->
    <!-- tpl.Wayfinder.row.parent --><!-- NEED THIS TEMPLATE SOMETHING ELSE -->
    <li class="first dropdown">
        <div class="btn-group"><a href="blog/blog-post/" title="Blog Post" class="btn"  >
    		Blog Post
    		
    	</a>
        <button class="btn dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
      </button>
    	<ul class="dropdown-menu">
    		<!-- tpl.Wayfinder.inner -->
    <!-- tpl.Wayfinder.row.inner -->
    <li  class="first">
        <a href="blog/blog-post/blog-sub" >Blog Sub</a>
    	
    </li>


    Thanks for your help in advance, and I look forward to being a part of this community.

    Aubrey
      • 44353
      • 10 Posts
      Just fyi - I found a workaround. There may be a cleaner way to do this, but with UltimateParent &id and Wayfinders +wf.docid I was able to insert a conditional statement into the parentrow template that gave me conditional control over the children of a parent with children. (that last bit sounds like something a preschool teacher would need to know...)

      [[!If? &subject=`[[UltimateParent? &id=`[[+wf.docid]]`]]` &operator=`EQ` &operand=`[[+wf.docid]]` &then='Parent with children stuff` &else=`Child with children stuff`]]
        • 22427
        • 793 Posts
        Or, a bit shorter:
        [[+wf.docid:is=`[[UltimateParent? &id=`[[+wf.docid]]`]]`:then=`Parent with children stuff`:else=`Child with children stuff`]]

        BTW: Well done logo!
          • 44353
          • 10 Posts
          Ahh... Much cleaner. Thank you ottogal! I have several conditional statements that will benefit from that syntax.

          And thanks for the logo compliment. I had a very talented designer who took my idea and really executed it well.