Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I need to pass a dynamic parameter to macro.
Is it possible without creating a usercontrol ?
look :
<umbraco:Macro idNode="1268" Alias="WBNTDisplayContactName" runat="server"></umbraco:Macro>
this is working but idNode must be dynamic
Basically I am looking for something like that :
<umbraco:Macro idNode="{./data[@alias = 'ContactProjet']}" Alias="WBNTDisplayContactName" runat="server"></umbraco:Macro
How can I do that ?
cheers !
I'm assuming you macro is an XSLT file. So you could just solve this in your XSLT:
<xsl:variable name="idNode" value="$currentPage/data[@alias = 'ContactProject']" />
And then you can just refer to the idNode everywhere like so:
<xsl:value-of select="$idNode" />
thanks !
It works.
But i thought it would be better to use a parameter if I want to re-use my template. If the node name (here the "id") is called something different in another XML input file it won't work anymore.
Hi,
Can use
<umbraco:Macro idNode="[#ContactProject]" Alias="WBNTDisplayContactName" runat="server"></umbraco:Macro>
to pass the value of the property on the current document to xslt or user control
Hope this helps.
Regards,
/Dirk
And here's the wiki reference...http://our.umbraco.org/wiki/reference/templates/umbracomacro-element
Cheers,
hey.
I tried this way the first time but I didn't manage to make it work.
Thanks to you it now works with the parameter.
cheers anyway
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Dynamic parameter to macro
Hi
I need to pass a dynamic parameter to macro.
Is it possible without creating a usercontrol ?
look :
<umbraco:Macro idNode="1268" Alias="WBNTDisplayContactName" runat="server"></umbraco:Macro>
this is working but idNode must be dynamic
Basically I am looking for something like that :
<umbraco:Macro idNode="{./data[@alias = 'ContactProjet']}" Alias="WBNTDisplayContactName" runat="server"></umbraco:Macro
How can I do that ?
cheers !
I'm assuming you macro is an XSLT file. So you could just solve this in your XSLT:
And then you can just refer to the idNode everywhere like so:
thanks !
It works.
But i thought it would be better to use a parameter if I want to re-use my template. If the node name (here the "id") is called something different in another XML input file it won't work anymore.
Hi,
Can use
to pass the value of the property on the current document to xslt or user control
Hope this helps.
Regards,
/Dirk
And here's the wiki reference...http://our.umbraco.org/wiki/reference/templates/umbracomacro-element
Cheers,
/Dirk
hey.
I tried this way the first time but I didn't manage to make it work.
Thanks to you it now works with the parameter.
cheers anyway
is working on a reply...