We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41454
    • 2 Posts
    Hi!
    I use MODX Revolution 2.2.4-pl (traditional)
    I need to make top menu with selected items if user is located on it.

    I need something like this with one on $is_active_* will be active to change css class in html menu output:

    <table border="0" cellspacing="15" align="right" background="white">
     <tr align="right">
      <td><a class="menu_about [[$is_active_about]]" href="/about.html">About</span></a></td>
      <td><a class="menu_news [[$is_active_news]]" href="/news.html">News</a></td>
    ...
     </tr>
    </table>
    


    Please, point me to right way to do this.
    Thanks.
      • 22427
      • 793 Posts
      You should try to use the Wayfinder snippet for menus. It automatically adds a class (the name of which you can choose) to the active item.
      By default, Wayfinder uses an unordered list for the menu ( <ul> ) instead of a table - that is more natural. But if you want to stay with a table, Wayfinder is even that flexible: You just have to define your own chunks for the &outerTpl and &rowTpl properties.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
          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
          • 41454
          • 2 Posts
          Hi!
          Thank you both for your replys!
          I will check wayfinder.