We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13202
    • 3 Posts
    I’m new to Modx, but very comfortable with PHP and Javascript. i’d like to modify one of the available snippets, and i understand the scripting part, but i am somehow missing the link between the parameters in the snippet call and the script. Can someone point me to an explanation of how the (& params ) in a snippet call are linked to the PHP script?

    thanks much!
      • 14050
      • 788 Posts
      Parameters are way to set variables in PHP.

      So if I had a snippet call that looked like this:

      [[Snippet? &param1=`Hello`]] and the php code looked like this:

      echo $param1;
      


      The output would be "Hello"

      Hope that helps.
        Jesse R.
        Consider trying something new and extraordinary.
        Illinois Wine

        Have you considered donating to MODx lately?
        Donate now. Every contribution helps.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Bottom line is, any &param parameters in either the snippet call or in the snippet’s configuration tab will be automatically available in your snippet as a simple $param variable.
          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
          • 13202
          • 3 Posts
          so Modx handles getting the params to the script. it’s like pure magic...way cool!! thanks a bunch grin