Hey,
I’m using a snippet several times in the same page, and I’m transfering to it deffrent variables each time (&var=`value`).
The problem is that the snippets runs each time with the variable from the last call to the snippet.
e.g.:
If I have the following calls to the snippet:
[[snippet? &var=`one`]]
[[snippet? &var=`two`]]
[[snippet? &var=`three`]]
Then all the three outputs, will be according to the &var=`three` and the snippet ignores any other variable in the previous calls.
How can I fix this?
Thanx
-
MODX Staff
- 10,725 Posts
Please post your snippet code and perhaps we can tell you what’s wrong...
-
MODX Staff
- 10,725 Posts
Simple misuse of placeholders. You need to use instance specific placeholder names, or use something like $modx->parseChunk (or a simple str_replace call), to replace those variables in the chunk within the scope of the snippet itself.