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

    I am trying to use my design with the MODx system, but have come to a problem with the DropMenu snippet. The problem is, I read in the source code of DropMenu the following:

    // $hereClass [ string ]
    // CSS Class for LI and A when they are the currently selected page, as well
    // as any ancestors of the current page (YOU ARE HERE)


    However, this doesn’t seem to give a class to the <a> tag at all, only the <li> tag. I need to use something along the lines of
    <a href='#' class='active'>
    However, I can’t seem to implement this. I guess it needs to be implemented around the following area of code, on line 260:

    if ($itm && !$selfAsLink && ($child['id'] == $modx->documentIdentifier)) {
    					$output .= "    <li class=\"$hereClass". ($numChildren == 0 ? ' last' : '')."\">$itm</li>$ie";
    				}


    ...But I’m not entirely sure how.

    PS, I need to use both selfaslink and hereclass, so I’ve modded the line as suggested in another thread to:

    if ($itm && ($child['id'] == $modx->documentIdentifier)) {
    					$output .= "    <li class=\"$hereClass". ($numChildren == 0 ? ' last' : '')."\">$itm</li>$ie";
    				}


    Thanks in advance for any help.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can work around the "a.here" lack, by using "li.here a" in your css.
        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