We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    ronaldlokers Reply #1, 18 years ago
    I’m working on a website that need’s 3 menu’s;


    • Menu (level 1)
    • Submenu (level 2)
    • Submenu of level 2 (level 3)

    The menu and submenu do work, but the submenu of level 2 doesn’t work like I want it. It shows "level 2" if there is no "level 3", but I only want to show the menu if there is a "level 3".

    I use this code:
    [!Wayfinder?startId=`[[UltimateParent? &top=`3` &topLevel=`3`]]` &level=`1` &hereClass=`current` &lastClass=`last` &outerClass=`custom-menu` &outerTpl=`outer-jeugdtandarts` !]


    What do I have to change to show the menu only when there is a menu on level 3???
      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 25483
      • 741 Posts
      ronaldlokers Reply #2, 18 years ago
      I think I found the problem, but I don’t know how to fix it.

      UltimateParent returns the ID for level 2 if the is no level 3. But I don’t know which part I have to change to only return a id if there is a level 3.
        with regards,

        Ronald Lokers
        'Front-end developer' @ h2o Media

        • 4310
        • 2,310 Posts
        [!Wayfinder?startId=`[*id*]` &level=`1` &hereClass=`current` &lastClass=`last` &outerClass=`custom-menu` &outerTpl=`outer-jeugdtandarts` !]

        Wouldn’t that do it if you placed this call on all level 2 pages?
        Or have I misunderstood?
          • 25483
          • 741 Posts
          ronaldlokers Reply #4, 18 years ago
          I want to use 1 template for the whole site, so there must be some check that tell’s me if I am on a level 2 page that is a folder.
            with regards,

            Ronald Lokers
            'Front-end developer' @ h2o Media

            • 3749
            • 24,544 Posts
            Would this help?

            &parentClass - (parent)
            CSS class denoting the menu item is a container and has children

              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 25483
              • 741 Posts
              ronaldlokers Reply #6, 18 years ago
              Quote from: BobRay at Sep 10, 2008, 06:29 PM

              Would this help?

              &parentClass - (parent)
              CSS class denoting the menu item is a container and has children



              I think I need "&levelClass", I can hide the wrong menu items with css then. But if there is no level 3 menu it will just show a empty block. So now I need to find a solution to hide the menu block if there is no menu item.
                with regards,

                Ronald Lokers
                'Front-end developer' @ h2o Media

                • 4172
                • 5,888 Posts
                You can try it with this snippet. It shows chunks related to the current level:
                set the wayfinder call in a chunk
                <?php
                //
                //GetChunkByLevel
                //
                //[[GetChunkByLevel? &chunks=`,,,@CODE<h4>Aufgaben:</h4>,@CODE<h4>Subaufgaben:</h4>` &debug=`0` ]]
                //[[GetChunkByLevel? &chunks=`chunk0,chunk1,chunk3,projectlist,projectlist` &debug=`0` ]]
                
                $chunks_arr = (isset($chunks))? explode(",",$chunks) : array(); // [ array ]
                $debug = (isset($debug))? $debug :0;
                
                
                $current_level = ( count( $modx->getParentIds( $modx->documentObject['id'] ) )+1 );// von Stefan
                $output=$chunks_arr[$current_level];
                
                if ($debug == '1'){
                echo 'current_level '.$current_level.' ';
                echo 'chunk '.$output;
                }
                
                if (substr($output,0,5) == '@CODE'){
                $output = trim(substr($output,5));
                }
                else {
                $output= "{{".$output."}}";
                }
                
                return $output;
                ?>
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 25483
                  • 741 Posts
                  ronaldlokers Reply #8, 18 years ago
                  Thanks Bruno17!! that did the trick laugh

                  I used this call:

                  [[GetChunkByLevel? &chunks=`,,subsubmenu,subsubmenu,subsubmenu` &debug=`0` ]]


                  And this snippet:

                  [!Wayfinder? &startId=`[[UltimateParent? &topLevel=`2`]]` &hereClass=`current` &lastClass=`last` &outerClass=`custom-menu` &outerTpl=`outer-jeugdtandarts`!]
                    with regards,

                    Ronald Lokers
                    'Front-end developer' @ h2o Media