XF 2.0 Use of variable in variable name in macros

XFA

Well-known member
Hi,

Not sure the title is understandable but I would like to retrieve in the code of a template macro, a variable value which name is based on an arg of the template macro.

Something like that:
Code:
<xf:macro template="my_template" name="my_name" arg-name="toto">
    <input type="hidden" name="{$name}_myfield" value="{$node.some_index.{$name}_myfield}" />
</xf:macro>

I think I already did that in xf1 and it worked but for xF2 it doesn't, any idea on how to achieve that ?

Thank you,
Clément
 
Use <xf:set var="$fieldName" value="{$name}_myfield" /> and then you should be able to access {$node.some_index.{$fieldName}}
 
Allright, will try thanks.

I did try some combination with xf:set but not that one... dumb me :)
 
Top Bottom