We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37059
    • 368 Posts
    I am trying to create an album selector for my Gallery snippet, i.e. a link to show album 1 or album 2 on the same page. I am doing this with a $_GET variable and a snippet that reads the $_GET array into placeholders, modx.request.something - in this case, the one I want is modx.request.type. I then feed this placeholder into the gallery call like so:

    [[!Gallery?
    &album=`[[!+modx.request.type]]`
    ]]
    


    So now, if 1 is selected, album 1 will display, and likewise with 2. What I am trying to do is deal with the situation where nothing is selected in the $_GET array. When that happens, I want the placeholder to default to 1 so that album 1 is displayed. I have a feeling there should be an easy way to do this with output filters, but I can’t think what it might be.

    Any help would be greatly appreciated.
      Jason
      • 37059
      • 368 Posts
      I’d still like to know how to do this, but I just found the &checkForRequestAlbumVar on Gallery, which solves my problem for now. smiley

      Edit: At least it would if I could get it working. But that’s another thread...
        Jason
        • 6228
        • 249 Posts
        An output filter, something like this, should do the trick:

        [[!Gallery?
        &album=`[[!+modx.request.type:default=`1`]]`
        ]]
          lo9on.com

          MODx Evolution/Revolution | Remote Desktop Training | Development
          • 37059
          • 368 Posts
          Thanks for the input. Maybe I’m doing something wrong, but that returns 1 no matter what value is in the type variable. huh
            Jason
            • 6228
            • 249 Posts
            You might also try:

            [[!Gallery?
            &album=`[[!+modx.request.type]]:default=`1` `
            ]]


            (note the space between the two backslashes - that is important)
              lo9on.com

              MODx Evolution/Revolution | Remote Desktop Training | Development
              • 37059
              • 368 Posts
              Quote from: cyclissmo at Apr 14, 2011, 12:48 PM

              [[!Gallery?
              &album=`[[!+modx.request.type]]:default=`1` `
              ]]


              Thanks - I’m afraid that returns null huh

                Jason