We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7557
    • 61 Posts
    Hi!
    How to get all snippet parameters, like string or array?
    Something like $_SERVER[’QUERY_STRING’], or foreach $_GET..., but for snippet?
    thx
      • 27708 MODX Staff
      • 2,502 Posts
      What are you asking about? Are you wanting to output all available parameters for a snippet? Are you trying to find all the values for parameters of a snippet? Or do you mean something entirely different? Parameters are php variables that are defined in the snippet code itself. In revolution if those are turned into properties it may (I say may because I have no idea) be possible to retrieve a list of properties for a snippet since they are stored values.

        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 7557
        • 61 Posts
        Quote from: smashingred at Sep 02, 2010, 07:13 AM

        What are you asking about? Are you wanting to output all available parameters for a snippet? Are you trying to find all the values for parameters of a snippet? Or do you mean something entirely different? Parameters are php variables that are defined in the snippet code itself. In revolution if those are turned into properties it may (I say may because I have no idea) be possible to retrieve a list of properties for a snippet since they are stored values.



        I try to pass all the parameters of snippet call in a snippet where they would be used as parameters for another snippet through runSnippet.
        Example pseudo code:

        [[outerSnippet? &my_param1=`value1` &my_param2=`value2` &parent=`5` &values=`6` &other=`7`]]
        outerSnippet code:

        foreach ($snippet_parameters as $k => $v)
        if(stripos ($k, ’my_’)) $my_param[$k] = $v
        else
        $param_for_inside_snippet[$k] = $v

        $out1 = $modx->runSnippet(’insideSnippet’,$param_for_inside_snippet));
        $out2 = other my code ...
        return $out1.$out2 or something ...

        thanks