Is it possible to have a Snippet that takes a placeholder as a parameters, as in:
[[mySnippet? ¶meter1=`1` ¶meter2=`[+myPlaceholder+]`]]
I have this and my parameter2 always comes in empty even though it should have a value.
Am I doing something wrong, or is this not possible?
Thanks!
Shaun
Followup: The issue appears to be with the fact that I have two instances of this snippet call in the same chunk, but with different parameters passed in.
If I break the calls into different snippets and hard-code the first parameter, the placeholder parameter works.
I just can’t seem to get any snippets that accept parameters to function properly when there is more than one of the snippet in the chunk.
Any ideas?
I am running evolution
I could be wrong, but I think it should work as long as the snippet that sets the placeholder comes before the one that uses it as a parameter.
If the page is cached, the second snippet should be uncached ( [!snippet!]). If the page is uncached, the snippet should be cached in Evo.
There are many instances in Evolution where the parsing order causes problems when you start nesting snippets and chunks and its often difficult to know what should be cached. Revolution is *much* more reliable in these kinds of situations because chunks and placeholders can be uncached, everything gets parsed when it should, and the cache control of individual elements is more independent.
-
MODX Staff
- 10,725 Posts
As long as the placeholder is set when the Snippet is parsed, it should pass the value of the placeholder. Otherwise, the tag will remain until the final phase of parsing when unprocessed tags are removed.