We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27305
    • 173 Posts
    I`m trying to use dropmenu to create a nice nav bar, however when I make the call on my template

    [[DropMenu? &menuName=`myMenu` &startDoc=`0` &levelLimit=`2` &topdiv=`true` &showDescription=`true` &subnavClass=`nestedLinks`]]

    The wrapping div should have the id ’myMenu’ but it has div ids of navlist and ul style of topnav. Where did they come from?

    <div id="navigation">
    <div class="navlist"><ul class="topnav">
    <li><a href="travel.html" title="">Travel</a></li>
    <li><a href="shopping.html" title="shopping">shopping</a></li>
    <li><a href="electrical.html" title="electrical">electrical</a></li>
    <li><a href="entertainment.html" title="entertainment">entertainment</a></li>
    <li><a href="finance.html" title="finance">finance</a></li>
    <li><a href="fashion.html" title="fashion">fashion</a></li>
    <li><a href="gifts.html" title="gifts">gifts</a></li>
    <li><a href="gambling.html" title="gambling">gambling</a></li>
    <li><a href="food-and-drink.html" title="food and drink">food-and-drink</a></li>
    <li><a href="internet.html" title="internet">internet</a></li>
    <li><a href="home-and-garden.html" title="Home and Garden">home-and-garden</a></li>
    <li><a href="health-and-fitness.html" title="Health and Fitness">health-and-fitness</a></li>
    <li><a href="car-hire.html" title="car hire">car-hire</a></li>
    <li><a href="mobile-phones.html" title="mobile phones">mobile-phones</a></li>
    <li><a href="pets.html" title="pets">pets</a></li>
    <li><a href="insurance.html" title="insurance">insurance</a></li>
    <li class="last"><a href="computers.html" title="computers">computers</a></li>
    </ul>
      I made my first site with modx
      ------------------------
      Shopping blog
      Sky+ HD
      • 27305
      • 173 Posts
      Actually I have now assigned a class to the wrapper div and ul, but I want an id on them not a class
        I made my first site with modx
        ------------------------
        Shopping blog
        Sky+ HD
      • You’ll have to hack the core code of the snippet unfortunately.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 27305
          • 173 Posts
          ah ok, in that case the documentation is wrong the docs at http://modxcms.com/snippet-dropmenu.html it says

          Example 1
          Creates menu with wrapping DIV with id=myMenu, starting at the site root, two levels deep, with descriptions next to the links, and nested UL elements with class=nestedLinks; output of menu can be placed in layout using placeholder named myMenu ( e.g. [+myMenu+] )

          The wrapping div contains a class not an id, is that correct?

            I made my first site with modx
            ------------------------
            Shopping blog
            Sky+ HD
            • 22815
            • 1,097 Posts
            Please post again both your snippet call and the output, as they seem to have changed from your top post. The doumentation appears to match with your first code sample.
              No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
              MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
              Forum: Where to post threads about add-ons | Forum Rules
              Like MODx? donate (and/or share your resources)
              Like me? See my Amazon wishlist
              MODx "Most Promising CMS" - so appropriate!
              • 27305
              • 173 Posts
              The call is this

              [[DropMenu? &menuName=`myMenu` &startDoc=`0` &levelLimit=`1` &topdiv=`true` &topnavClass=`strat` &topdivClass=`simon` ]]

              and the output is this

              <div class="simon"><ul class="strat">
              <li><a href="travel.html" title="">Travel</a></li>
              <li><a href="shopping.html" title="shopping">shopping</a></li>
              <li><a href="electrical.html" title="electrical">electrical</a></li>
              <li><a href="entertainment.html" title="entertainment">entertainment</a></li>
              <li><a href="finance.html" title="finance">finance</a></li>
              <li><a href="fashion.html" title="fashion">fashion</a></li>
              <li><a href="gifts.html" title="gifts">gifts</a></li>
              <li><a href="gambling.html" title="gambling">gambling</a></li>
              <li><a href="food-and-drink.html" title="food and drink">food-and-drink</a></li>
              <li><a href="internet.html" title="internet">internet</a></li>
              <li><a href="home-and-garden.html" title="Home and Garden">home-and-garden</a></li>
              <li><a href="health-and-fitness.html" title="Health and Fitness">health-and-fitness</a></li>
              <li><a href="car-hire.html" title="car hire">car-hire</a></li>
              <li><a href="mobile-phones.html" title="mobile phones">mobile-phones</a></li>
              <li><a href="pets.html" title="pets">pets</a></li>
              <li><a href="insurance.html" title="insurance">insurance</a></li>
              <li class="last"><a href="computers.html" title="computers">computers</a></li>
              </ul>
                I made my first site with modx
                ------------------------
                Shopping blog
                Sky+ HD
                • 22815
                • 1,097 Posts
                Right. When you had the snippet call like the one in Example 1, the result was how Example 1 described.

                Now that you have changed the snippet call - notably, passing a class name fo the top div - the result is different.

                DropMenu seems to not put out an ID if there is a class name passed.

                Judging from your results, the line of the documentation that *is* wrong is:

                &topdivClass [ string ] - CSS Class for DIV wrapping top level UL. Defaults to ’topdiv’
                which should say
                &topdivClass [ string ] - CSS Class for DIV wrapping top level UL. If not set, an ID set to the name of the menu is added to the DIV instead.

                Does the kludge
                &topdivClass=`simon" id="mymenu`
                work?
                EDIT: In case it’s not obvious, the idea here is to trick DropMenu. DropMenu will start that string off with class=" and end with another ", but inside you’re ending the class early and starting the ID. DropMenu’s " to end the class ends up ending the ID.
                  No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                  MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                  Forum: Where to post threads about add-ons | Forum Rules
                  Like MODx? donate (and/or share your resources)
                  Like me? See my Amazon wishlist
                  MODx "Most Promising CMS" - so appropriate!
                  • 27305
                  • 173 Posts
                  Do you know how I can add the id to the php code?
                    I made my first site with modx
                    ------------------------
                    Shopping blog
                    Sky+ HD
                    • 27305
                    • 173 Posts
                    What does "Does the kludge" mean? is that a slang word, sorry don’t mean to be rude but I don’t have a clue what that means.
                      I made my first site with modx
                      ------------------------
                      Shopping blog
                      Sky+ HD
                      • 27305
                      • 173 Posts
                      Nope it generates

                      div class="simon" i">
                        I made my first site with modx
                        ------------------------
                        Shopping blog
                        Sky+ HD