You can pass additional parameters into the slot when you use #slot or #initslot macros. Just pass in a string that looks like the params part of an HTML query request…
Once you’ve done this, then your snippet template can check the value of your param with $rx.asmhelper.getSingleParamValue($sys.params,‘foo’) and you can base your conditional statements around this value.
I just tried this and $sys.params contains all the usual sys_XXXX parameters but none of the ones I passed using #slot.
So $rx.asmhelper.getSingleParamValue($sys.params,‘YYYYY’) in the slot snippet doesn’t return anything.
Did I miss something?
Even though that should have worked… it appears that something is lost in the translation from parent item to slot item… so, here’s another way to do it:
in the parent template, just before calling your slot, add the parameter to the current assembly item with something like this:
$sys.assemblyItem.setParameterValue('foo','bar')
Yes it’s a little crazy and you shouldn’t have to do it this way, but at least the param gets passed to the slotted item’s template.
Could we get a Percussion Support person to chime in on why the code I provided earlier doesn’t work?
Looks like the extra params in the #slot macro are only supplied to the AutoSlotContentFinder, and not passed into the related item assemblers, so adding the extra param to $sys.assemblyItem is the only way to pass a value to a slot through a parameter…
Although, I’ve seen, in another recent thread, that apparently, variables from the parent template’s scope are also passed as a copy into the child template’s variable space.