We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40088
    • 708 Posts
    Here's a very simple 3 item top-level menu using getResources:

    Menu Chunk
    <li>
    <a href="[[~[[+id]]]]">[[+menutitle:default=`[[+pagetitle]]`]]</a>
    [[getResources?
    &parents=`[[+id]]`
    &totalVar=`numChildren[[+id]]`
    &toPlaceholder=`children[[+id]]`]]
    [[+numChildren[[+id]]:gt=`0`:then=`<ul>[[+children[[+id]]]]</ul>`:else=``]]
    </li>


    getResources call
    [[getResources?
    &parents=`0`
    &depth=`0`
    &limit=`3`
    &sortby=`menuindex`
    &sortdir=`ASC`
    &tpl=`Menu`
    ]]


    Seems to work ok. I would like to add an 'active' class to the current page's menu link but I'm not sure how. Suggestions?

    Revo 2.2.13

    This question has been answered by sottwell. See the first response.

      Todd
    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Why are you using getResources for a menu? Wayfinder (or pdoMenu) is specifically intended for multi-level menus.
        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
        • 40088
        • 708 Posts
        I knew that was going to be the first question. Because of this ongoing issue that I no longer have time to deal with, https://forums.modx.com/thread/?thread=89506&page=1. Sure, I would prefer to use WF but I also need something that works right now, and getResources does.

        So, the active class? [ed. note: todd.b last edited this post 12 years, 6 months ago.]
          Todd
          • 40088
          • 708 Posts
          Quote from: sottwell at Mar 12, 2014, 11:28 PM
          Why are you using getResources for a menu? Wayfinder (or pdoMenu) is specifically intended for multi-level menus.

          I wasn't aware of pdoMenu. Unlike the WayFinder issue mentioned above pdoMenu works for me. Thanks.
            Todd