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

    Need help with dropMenu.

    Sitemap is as under:
    ----------------
    MainWebsite.org
    |-home (document)
    |-content (folder / id="11")
    |-dept1 (folder)
    |-dept2 (folder)
    |-dept3 (folder)

    Requirement: My main menu needs to show dep1, dept2, dept3. Clicking on the department needs to make the link "class=selected" so that it can be styled differently.

    My Solution: Use dropmenu (as is) in a "chunk" which in turn is placed on the template. My dropmenu call goes like this [[DropMenu? &menuName=’mainMenu’ &startDoc=11 &levelLimit=1 &topnavClass=’cf’ &titleOfLinks=’pagetitle’ &hereClass=’selected’ &selfAsLink=’true’]]

    Problem:
    1) The links are shown correctly, but, the title="" attribute is empty (inspite) of filling up ALL the document specific variables.
    2) The hereClass value (i.e. "selected") does NOT append to the li/a of the active link.

    Where am I going wrong?

    Thanks in advance.

    -raavi
    • Don’t use single-quote characters: ’

      Use backticks: `
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 7131
        • 83 Posts
        dernier_recours Reply #3, 18 years ago
        For problem 2, there are problems with hereclass and setaslink. Look here:
        http://modxcms.com/forums/index.php/topic,2609.msg17880.html#msg17880
          at the edge of dawn,
          you ask yourself if your shadow did follow you down
          all night long
          • 24278
          • 165 Posts
          Thanks ryan and dernier,

          Both the suggestions helped! This IMHO is the best support forum there is.

          I would like to extend my sincere appreciation to each one of you.

          BTW, in the DropMenu Snippet, can I give my bounding DIV an ID rather than a CLASS. I did try it.

          Taken from the documentation with DropMenu
          ###########################################
          // Usage Examples #
          // ###########################################
          // 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+ ] )
          // [[DropMenu? &menuName=`myMenu` &startDoc=`0` &levelLimit=`2` &topdiv=`true` &showDescription=`true` &subnavClass=`nestedLinks`]]
          it doesn’t seem to work.


          warm regards,

          -raavi
            • 22302
            • 42 Posts
            If you’ve changed that part of the code it won’t work. All those lines are comments (each of those lines start with //) and won’t be read by php. I think you’ll have to change this part:
            // build the output
            			$topdivcls = (!empty($topdivClass)) ? ' class="'.$topdivClass.'"' : '';
            			$topdivblk = ($topdiv) ? "<div$topdivcls>" : '';
            			$topnavcls = (!empty($topnavClass)) ? ' class="'.$topnavClass.'"' : '';
            			$subdivcls = (!empty($subdivClass)) ? ' class="'.$subdivClass.'"' : '';
            			$subdivblk = ($subdiv) ? "<div$subdivcls>$ie" : '';
            			$subnavcls = (!empty($subnavClass)) ? ' class="'.$subnavClass.'"' : '';
            			$output = ($toplevel) ? "$topdivblk<ul$topnavcls>$ie" : "$ie$subdivblk<ul$subnavcls>$ie";
            

            But I don’t see the purpose of using a id instead of class for that.
              [b]Benoit Deziel[b]