We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19534
    • 183 Posts
    Hey

    I’d like to apply an output filter to the return value of a snippet:

    With
    [[!getReqParam? &name=`value`:urlencode]]
    

    I’m getting an empty output but
    [[!getReqParam? &name=`value`]]
    

    works fine.

    Am I using the wrong syntax?
      Add-On to easily manage your multilingual sites: Babel
      • 1778
      • 659 Posts
      Hello

      Did you try

      [[!getReqParam? &name=`value:urlencode`]]

      Cheers
        • 19534
        • 183 Posts
        Hmm, I don’t think this make sense because getReqParam returns the value of
        $_GET[$name]

        See http://modxcms.com/extras/package/?package=665 for details.

        I don’t want to apply the filter on the name parameter. I want to apply it on the value which is return by
        [[!getReqParam? &name=`value`]]
          Add-On to easily manage your multilingual sites: Babel
          • 3749
          • 24,544 Posts
          Which version of MODx? Your original version should work in Revolution. In Evolution, you’d have to install the PHX plugin.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 19534
            • 183 Posts
            Hey Bob!

            I’m using Revolution (2.0.3). But
            [[!getReqParam? &name=`value`:urlencode]]
            returns nothing whereas $_GET[’value’] contains ’test’. When using
            [[!getReqParam? &name=`value`]]
            ’test’ is returned.

            getReqParam is a snippet provided by this package: http://modxcms.com/extras/package/?package=665
              Add-On to easily manage your multilingual sites: Babel
              • 3749
              • 24,544 Posts
              It’s hard to know what’s going wrong. All the :urlencode output modifier does it replace $output with urlencode($output). Maybe there’s something odd about what is returned from getReqParam. I don’t have that package installed.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 27985
                • 54 Posts
                I figured out a solution to a problem like this:

                instead of

                [[!getReqParam? &name=`value`]]

                try

                [[!getReqParam:replace=`A==B`? &name=`value`]]

                someone
                  MODx 2.0.6
                  PHP 5.3.3
                  MySQL 5.1.50
                  • 8109
                  • 128 Posts
                  "Someone" is correct. Output modifiers must go after the snippet name and before the questions mark that precedes the snippet arguments.
                    Revo 2.0.8-pl