We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5282
    • 147 Posts
    Hi everyone ! i’d like to configure my dropmenu so that it behaves like this ( quite difficult to explain huh, moreover english isn’t ma native language :s ) :
    _ all the root elements are displayed
    _ all the elements "leading" to the present element, meaning "parent", "grandparent" ... and all the "brothers" of all those parents ( so all "cousins", "cousins" of parents,grandparents ... are excluded )


    i read the documentation but it can’t find the rights options that would allow me to configure my menu, maybe there are other menusnippets that i don’t know ??

    thx
      i’m not a native english speaker, sorry if there are any mistakes ! smiley

      Pikkitux.com Website about Ubuntu Linux, Website Creation, and many other how-tos, tips and tricks ... ( French Language, and of course Modx Powered ! )
    • You mean all "siblings" of a given document are displayed? Then use its parent as the startID. All siblings and if you set the depth to be more than 1 level all of their children will be displayed for as many levels as you specify.

      You would call it like this:

      [!DropMenu?startID=`[*parent*]`!]
      


      or, if you want this to be the parent of some other document, use a snippet that returns the parent of the given document as the startID value.

      [!DropMenu?startID=`[[getParent?docID=`xx`]]`!]
      


      There is a modx class function getParent that will do the job just fine.

      // getParent snippet
      // arguments:
      // &docID     the ID of the document whose parent we want
      
      $docID = isset($docID) ? $docID : $modx->documentIdentifier;
      $parent = $modx-getParent($docID,1,'id');
      return $parent['id']
      
        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
        • 13577
        • 302 Posts
        I know that ListMenu (written for Etomite and attached below) can do what you ask. But I haven’t touched it in 4 months... so exact how-to’s will be rusty to me. However, I tend to go long on snippet documentation so things can be understood without reading all the code. It might be worth a look. It should be noted that this was NOT converted over to MODx (though it should work), so it will not respect the show/hide in menu checkbox... yet. I may have to put this on my upgrade list as well.
          Standard Disclaimer
          I could be totally wrong.