Hi,
I’m trying to work with a prebuilt snippet, and add another param to the it invoke. Having read other posts, i see that it is just a case of putting [[ mySnipper? &Param1=`1` &Param2=`2`]] etc.
The invoke had a param already that was called pid that takes [*id*], and this shows up in the snippet, no problem. Any additional param that i add doesn;t show up within the snippet. Any ideas?
I’ve got the param in single ticks, not single quotes, have tried using isset within the snipper, have tried just outputting it, all are a no go
Tony
Hi Both,
Thanks for the replies.
The idea of this is that i will be able to put the snippet into several templates, and change the param on the template based on if i want a certain output to appear or not. So yes the code may look pointless in the example above. This is what i have at the moment:
This is the call to the snippet:
[[ userAccount? &pid=`[*id*]` &pid2=`[*id*]` &isRegistration=`1` ]]
And this is the PHP code within the snippet:
<?php
$isReg = 0;
if ($isRegistration != ’’) {
$isReg = 1;
}
echo $isReg . ’
’;
echo "isRegistration " . $isRegistration . ’
’;
echo "pid " . $pid. ’
’;
echo "pid2 " . $pid2 . ’
’;
?>
As you can see i have three params, two of them coming from Modx generated variables and then one that is hardcoded that i will use in different ways on different templates. the first param pid is available within the snippet, but the pid2 and isRegistration aren’t coming through.
Any ideas?
Tony
I don’t see anything wrong with your code (though the $isReg variable seems redundant -- you could just use $isRegistration).
Take out the space at the beginning of the snippet tag.
Note that if the ID is 0, it won’t print.
You are using Evolution, right?
-
☆ A M B ☆
- 24,524 Posts
In Evo, that snippet works just fine exactly as copy/pasted from your post.