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

    I try to configure Dropmenu and I would like a specific class for subfolder who have chidren like this:

    <ul>
    <li>fruit
    <ul>
    <li class="daddy">apples</a>
    <ul>
    <li>green</li>
    <li>red</li>
    </ul>
    </li>
    <li>banana
    </li>
    </li>
    <li>vegetable</li>
    <ul>
    How can I do that? I didn’t find any response in the documentation of dropmenu

    Thanks
      • 25663 MODX Staff
      • 12,272 Posts
      You would have to change the code to add a class based on the document having (active) children. If you file a feature request in teh bug tracker this is something we can look at adding for the future.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 32847
        • 171 Posts
        Thank you,
        Unfortunaly, I have to conclude this is not possible (today).
        I think that could be a good feature for dropmenu.
        I am going to post a feature request cause I am not a good developper smiley
          • 25663 MODX Staff
          • 12,272 Posts
          What’s the purpose of the extra "parent" class, btw? There may be a way to style it without having to add an extra class.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 32847
            • 171 Posts
            the purpose is to make a menu like this
            http://www.htmldog.com/articles/suckerfish/dropdowns/example/

            Arrows are just for fun and an easiest navigation! But I need a "daddy" class on the <li> element or in the link inside.

            I have started to do the same with MODx, that’s ok and I am very enthousiast but I haven’t my daddy class. wink
            I saw there was many option in dropmenu and may be it was possible but you said it wasn’t.

            I don’t thing I could do the same without an extra class but idea are wellcome.


              • 25663 MODX Staff
              • 12,272 Posts
              I don’t think it’s in there honestly, but if you’ll log it in the bugtracker as a feature request it will be no later than 0.9.2. wink
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 32847
                • 171 Posts
                Oups, sorry for my poor english grin
                  • 19849
                  • 19 Posts
                  Quote from: xeres at Dec 29, 2005, 11:44 AM

                  the purpose is to make a menu like this
                  http://www.htmldog.com/articles/suckerfish/dropdowns/example/

                  Arrows are just for fun and an easiest navigation! But I need a "daddy" class on the <li> element or in the link inside.

                  I have started to do the same with MODx, that’s ok and I am very enthousiast but I haven’t my daddy class. wink



                  If you search and find each occurrenc of ’<a href=’ in the DropMenu snippet and add the following as the link class: class="’.$child[’isfolder’].’"

                  Then you should have a class of 1 or 0 for parent and child.

                  Sorry, I’m a designer and not a coder - so this may be a rather horrible hack.

                  All the best

                  Martin

                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    I did something similar here http://www.alandaniel.co.uk/49.html, and I hacked the DropMenu snippet to give me the html identifiers that I needed.

                    Line 277 to give each top <li> (when using empty folders) an individual class so I could style each one differently (you can skip the .$categoryNumer if you don’t want individual styling):

                    $class .= ($class ? ' ' : '').$categoryClass.$categoryNumber;


                    And I get this HTML as a result:

                    <ul class="topnav">
                      <li class="category1">Under Construction
                        <ul>
                          <li><a href="51.html" title="">Project on 1st street</a></li>
                          <li><a href="52.html" title="">Mell street project</a></li>
                          <li><a href="53.html" title="">31-36 Dane street</a></li>
                          <li class="last"><a href="54.html" title="">Selmar department store</a></li>
                        </ul>
                      </li>
                      <li class="category2">Commercial
                        <ul>
                          <li><a href="56.html" title="">Project 1</a></li>
                          <li><a href="57.html" title="">Project 2</a></li>
                          <li><a href="58.html" title="">Project 3</a></li>
                          <li class="last"><a href="59.html" title="">Project 4</a></li>
                        </ul>
                      </li>
                    </ul>
                    
                      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
                      • 32847
                      • 171 Posts
                      Oh, it’s an old topic, may be my first wink
                      I am going to test that cause I am a bit stronger in MODx Now

                      [edit]
                      just modify

                      '<a href="[~'.$child['id'].'~]" title="'.$child[$titleOfLinks].'" class="daddy">'

                      in this part of code //it’s a folder and it’s below the top level
                      Thanks