We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25018
    • 9 Posts
    So I was running a snippet to output a Wayfinder listing.
    I wanted the output to be dynamic since depending on what page
    I’d end up on, the list would change.

    I decided to use the modx api call:
    $modx->runSnippet('Wayfinder', $params);

    This method seems to output based on the current document no matter what params I pass.
    So If I have nested pages, it would list only documents below even if I passed over $params = array(’startId’ => `2`)

    No if I echo a modx snippet call like
    echo '[[Wayfinder?startId=`2`]]';

    This way output the correct listing on each page.

    Anyone know what I am doing wrong?
    Thanks
    Rich
      • 4041
      • 788 Posts
      Perhaps it has to do with the backticks used in the $params = array(’startId’ => `2`), these should be single quotes like so:
      $params = array(
                     'startId' => '2'
                     );

      Backticks are used only in snippet params which are called inside the normal snippet tags, like your echo example.

      Hope that helps smiley

        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Actually, that being an integer value, it doesn’t need any quote marks at all.
        'startId'=>2
          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