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

    I have the following chunk, which I call to display my accordion menu.
    <li[[+cls:notempty=` class="[[+cls]]"`]]>
            <a href="#">[[+showName:notempty=`[[+name]]`]]</a>
            <ul class="acitem">
                [[GalleryAlbums? &parent=`[[+id]]` &showAll=`0` &rowTpl=`gallery-sub-tpl` &prominentOnly=`0`]]
            </ul>
    </li>
    


    in line:
    <a href="#">[[+showName:notempty=`[[+name]]`]]</a>
    


    I want to be able to check the url param ($_GET in PHP) and if that strin equals my `[[+name]] value, then to add a class. example:
    if($_GET['galAlbum']==[[+name]]){
    <a href="#" class="active">[[+showName:notempty=`[[+name]]`]]</a>
    } else {
    <a href="#">[[+showName:notempty=`[[+name]]`]]</a>
    }
    


    Is there something simplified in modx chunk? is there another way of doing this? just a reminder, this is in the chunk.

    thanks in advanced.
      • 36926
      • 701 Posts
      Are you just trying to create a menu with active class applied to the page your viewing. If so use wayfinder.

      I thinks there's a tut for creating an accordion using wayfinder. Sites down at the moment so can't provide the link
        • 22303 MODX Staff
        • 10,725 Posts
        See the getUrlParam snippet.
          • 37317
          • 77 Posts
          hi,

          Bennyb, i saw that wayfinder has an accordian, but it doesn't work well with the gallery. it seems its mainly for resources pages.

          opengeek, your suggestion looks great. how do i implement the "if" statement using this addon?

          thansk again
            • 37317
            • 77 Posts
            I decided to put an iframe instead of a div.
            so i just change the src of the iframe and load the content within.
            this way, the accordion menu is always open because the page doesnt reload..
            have a look.
            www.shaysamia.com/portfolionew.html
            10x