We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37234
    • 44 Posts
    Why wont this work? Is MODX processing the gallery call in the system before it parses the PHP variable $gallery?

    [[!Gallery? &album=`<?php echo $gallery; ?>` &plugin=`galleriffic`]]


    How can I make this dynamic?
      • 4172
      • 5,888 Posts
      you can not use php directly in a template or chunk in modx.

      where do you set the $gallery-var?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37234
        • 44 Posts
        Hi, I am using it in a snippet. My page just calls the snippet. A really simplified version of my snippet looks like:

        <?php
        $gallery = $_GET['gallery'];
        ?>
        [[!Gallery? &album=`<?php echo $gallery; ?>` &plugin=`galleriffic`]]
        <?php
          • 4172
          • 5,888 Posts
          I see, what you are trying.

          you can do:

          <?php
          $params['album'] = $_GET['gallery'];
          $params['plugin'] = 'galleriffic';
          $output = $modx->runSnippet('Gallerie',$params);
          
          return $output;


          or install the getReqParam - snippet and do this:

          [[!Gallery? &album=`[[!getReqParam? &name=`gallery`]]` &plugin=`galleriffic`]]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 4172
            • 5,888 Posts
            I see, what you are trying.

            you can do this in your snippet:

            <?php
            $params['album'] = $_GET['gallery'];
            $params['plugin'] = 'galleriffic';
            $output = $modx->runSnippet('Gallerie',$params);
            
            return $output;


            or install the getReqParam - snippet and do this in your template/content:

            [[!Gallery? &album=`[[!getReqParam? &name=`gallery`]]` &plugin=`galleriffic`]]

            [ed. note: Bruno17 last edited this post 14 years, 10 months ago.]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!