assign_prefix
The assign_prefix parameter to many NATS functions lets you change output variable names. For example, the NATS template function, nats_encode creates the following variable:
{$encoded}
Unfortunately, if you already have a Smarty variable named $encoded when you call nats_encode, the new value overwrites the old value. We designed assign_prefix to solve this problem. Call nats_encode with an argument to the assign_prefix parameter to have all of its output variables prefixed with your argument. For example: the following code,
{nats_encode assign_prefix="myprefix_"}
puts the output in,
{$myprefix_encoded}
You should be able to use assign_prefix on any NATS template function that emits a variable.
Last updated
Was this helpful?