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

    I have trouble figuring this out. I edit the chunk to include a snippet. To that snippet I need to pass parameters, and some parameters are placeholders of main chunk. I figured parameters are not passed unless first used above snippet call. To overcome this I call that placeholder in HTML comment.
    To illustrate what I'm talking about, here is pseudo-example placed in some chunk:
    <!-- [[+somePlaceHolder]] -->
    [[!snippet? &arg1=`txt` &arg2=`[[+somePlaceHolder]]` ]]


    This does not work to me without a comment. Of course, also not working if used as:
    [[!snippet? &arg1=`txt` &arg2=`[[!+somePlaceHolder]]` ]]


    Can this be overcome using Property sets (tried, didn't work). I think I saw something in the docs about creating Property sets in situations like this?
      • 22303 MODX Staff
      • 10,725 Posts
      Nested snippets in a tag are parsed before the outer tag is processed, if the nested tags are cacheable or the outer tag is non-cacheable. Property Sets are not parsed in this way, allowing you to pass tags into the Snippet without them being pre-processed and sending the output they produce.
        • 37012
        • 32 Posts
        Thanks, just what I needed!
        Changed the above code to
        [[snippet? &arg1=`txt` &arg2=`[[+somePlaceHolder]]` ]]

        and it works.
        Edit: I re-read your post, and now I have no idea how it worked laugh [ed. note: gr00__ last edited this post 15 years, 1 month ago.]