We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22674
    • 12 Posts
    dear everyone,

    How to call snippet which have a parameter using $modx->runSnipet?

    for example [[Ditto? &startID=50]]

    Thank you
      • 36592
      • 970 Posts
      Quote from: paramartha at Sep 17, 2008, 04:30 AM

      dear everyone,

      How to call snippet which have a parameter using $modx->runSnipet?

      for example [[Ditto? &startID=50]]

      Thank you
      http://wiki.modxcms.com/index.php/API:runSnippet

      See the ’Notes’ part, which is at the bottom of this page.
        • 26903
        • 1,336 Posts
        runSnippet has a $params variable you can use for parameter passing as below taken from here http://wiki.modxcms.com/index.php/API:runSnippet

        $dittoOutput = $modx->runSnippet(
                "Ditto",
                array(
                    "tpl" => "<post><title>[+title+]</title><summary>[+summary+]</summary></post>"
                )


        You would change it to ’array("startID" => 50)
          Use MODx, or the cat gets it!