We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20765
    • 90 Posts
    myfriendscallmebill Reply #1, 20 years, 2 months ago
    I’ve written a snippet that puts the docID of the referring page into a placeholder named [+referingDocId+]. I want to use it as a parameter to the GetField snippet. But when I call GetField as follows...

    [!GetField? &docid=`[+referingDocId+]` &field=`content` &parent=`0` !]

    ... I get no output.

    Is this because: (a) placeholders can’t ever be parameters in snippet calls, (c) GetField can’t handle them, (c) I’ve got some garbage in my result (although it looks like a simple integer), (d) I’m using the wrong syntax, (d) other...?
      • 10487 MODX Staff
      • 1,535 Posts
      (a) is the closest answer. In most cases, snippets are processed before placeholders by the current version of the document parser.

      Best bet is to use $modx->runSnippet() from within your first snippet to get the desired output from the GetField snippet.

      Hope that helps,
      Garry
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 20765
        • 90 Posts
        myfriendscallmebill Reply #3, 20 years, 2 months ago
        Quote from: garryn at Aug 24, 2006, 05:12 PM

        Best bet is to use $modx->runSnippet() from within your first snippet to get the desired output from the GetField snippet.

        Thank you very much. I’ll try that.