We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I’m not thrilled about having to write umpteen levels of CSS. So, I write this for my three-level menu. Then for some reason a document in the third level gets a child document. Now I have to go edit the css for a fourth level. What is the advantage in having the current item not be an active link? Sometimes I wonder if it’s not a case of robbing Peter (convoluted CSS) to pay Paul (slighly "cleaner" HTML)...
      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
      • 25663 MODX Staff
      • 12,272 Posts
      Actually, if you’ve got all other links in the menu structure, then the only non-link is the current page you’re on. It’s the same amount of CSS, or maybe less, that way.

      Also, one could consider it more "semantically correct" to not put a link that takes you right back to the exact page you’re already on in a navigation menu, too. I think Jakob Nielsen is a big proponent of that actually. wink

      As far as adding another level of flyouts, I gotta think on that one for a second or two ... but I suspect the CSS could be the same amount if anything else is needed at all.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 4095
        • 372 Posts
        Quote from: rthrash at Nov 30, 2005, 11:21 PM


        The selected level still has a link:

        				<li class="here last"><a href="operations.html" title="Operations Level Courses">Operations Level</a>


        If it didn’t, it would look like this:

        				<li class="last">Operations Level


        Ahhhh, so that might explain why I am going made not able to make it work smiley

        I tought I had it off, the snippet is configured as below. I’snt this correct for what I need?

        // $selfAsLink [ true | false ]
        // Define if the current page should be a link (true) or not (false)
        $selfAsLink = (!isset($selfAsLink)) ? false : ($selfAsLink==true)
          [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
          Admin Sandbox Login: sandbox Password: castle
          • 28042 ☆ A M B ☆
          • 24,524 Posts


          [!DropMenu?blah blah...&selfAsLink=`false`!]
            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
            • 25663 MODX Staff
            • 12,272 Posts
            Hmmm... based on looking at that config code, don’t include any configuration parameter for &selfAsLink and you should be fine, as it defaults to false. &selfAsLink=`Daffy Duck` or any other passed in parameter for that matter, including `false`(!), will result in selfAsLink being set to true.

            Alternately, if you want to pass an explicit value in, change that line to:
            $selfAsLink = (!isset($selfAsLink)) ? false : "$selfAsLink";

              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The line is fine as it is; it sets it to "false" if it’s not passed at all, while if it is passed it sets it to whatever got passed, true if true, false if false.
                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
                • 25663 MODX Staff
                • 12,272 Posts
                And now you see why I don’t get to contribute much code to this project!
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Your way would work too! This way is idiot-proof, though; if a user puts in anything other than `true` it will evaluate to false. I’m glad you drew it to my attention, I’ll have to make sure to use it in my snippets!
                    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
                    • 4095
                    • 372 Posts
                    I have tried calling the snippet by [!DropMenu!] and the snippet is configured like this:
                    $selfAsLink = (!isset($selfAsLink)) ? false : "$selfAsLink";


                    I have called the snippet by [!Dropmenu?&selfAsLink=`false`!] and the snippet configured like this which is its default setting
                    $selfAsLink = (!isset($selfAsLink)) ? false : ($selfAsLink==true)


                    In both cases I get multipule HERE selectors, where as it should have been on the last menu item only as thats the page I’m currently on.

                    <li class="last here"><a href="temp.html" title="Temporary stuff">Temp</a>
                      <ul>
                        <li class="last here"><a href="operations.html" title="Operations Level Courses">Operations Level</a>
                          <ul>
                            <li class="here last">Emergency Management L2</li>
                          </ul>
                        </li>
                      </ul>
                    </li>


                    Again the menus hide and reveal fine, its just the current item highlight not working on Submneus when there are Sub Submenus present.

                      [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                      Admin Sandbox Login: sandbox Password: castle
                      • 25663 MODX Staff
                      • 12,272 Posts
                      So which ones should be blue? I assumed from your earlier description that ONLY the page you’re currently on should be blue, and not the document’s parent/grandparent docs. So based on your code above:

                      If you want all the links in the "here page" branch blue, and the other "non-here" pages black:
                      li a { color: #000 }
                      li.here a, li.here { color: #000080 }


                      If you want ONLY the current doc blue.
                      li.here { color: #000080 }
                      li a, li.here a { color: #000 }

                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me