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 have macro on root level which I'm having some trouble getting resursive. Using ultimate picker from Lees example. Works fine on the start page but not on subpages, what should I change?
Thanks / Niklas
<code>
<xsl:template match="/"> <xsl:variable name="preNodes"> <xsl:variable name="relatedContent" select="$currentPage/monthOfferPicker" /> <xsl:variable name="nodeIds" select="umbraco.library:Split($relatedContent, ',')" /> <xsl:for-each select="$nodeIds/value"> <xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/> </xsl:for-each> </xsl:variable> <xsl:variable name="nodes" select="msxml:node-set($preNodes)/*[@isDoc]" /> <xsl:if test="count($nodes) > 0"><xsl:for-each select="$nodes"> <xsl:variable name="mediaId" select="number(monthOfferImage)" /> <xsl:if test="$mediaId > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img> <xsl:attribute name="src"> <xsl:text>/ImageGen.ashx?image=</xsl:text> <xsl:value-of select="$mediaNode/umbracoFile" /> <xsl:text>&height=130</xsl:text> <xsl:text>&compression=95</xsl:text> <xsl:text>&constrain=true</xsl:text> </xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="$mediaNode/@nodeName" /></xsl:attribute> </img> </xsl:if> </xsl:if> <h5> <xsl:variable name="monthOfferLink" select="monthOfferLink" /> <xsl:if test="$monthOfferLink!= ''"> <a href="{umbraco.library:NiceUrl($monthOfferLink)}"> <xsl:value-of select="monthOfferHeadline"/> </a> </xsl:if> </h5> <xsl:value-of select="monthOfferText" disable-output-escaping="yes"/> <xsl:variable name="monthOfferLink" select="monthOfferLink" /><xsl:if test="$monthOfferLink!= ''"> <a class="arrowTextLink" href="{umbraco.library:NiceUrl($monthOfferLink)}"> Läs mer </a></xsl:if></xsl:for-each> </xsl:if></xsl:template>
</code>
Hi Niklas, I do not know if it will solve your problem but maybe. I know that it is possible to put an attribute on your macro.
The attribute is called recursive and has the value true. So maybe you could try something like this.
<umbraco:Macro Alias="macoAlias" recursive="true" runat="server"></umbraco:Macro>
I have not tried myself so I do not know if it will solve your issues. But hope it helps you.
/Dennis
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Recursive from ultimate picker
Hi
I have macro on root level which I'm having some trouble getting resursive. Using ultimate picker from Lees example. Works fine on the start page but not on subpages, what should I change?
Thanks / Niklas
<code>
<xsl:template match="/">
<xsl:variable name="preNodes">
<xsl:variable name="relatedContent" select="$currentPage/monthOfferPicker" />
<xsl:variable name="nodeIds" select="umbraco.library:Split($relatedContent, ',')" />
<xsl:for-each select="$nodeIds/value">
<xsl:copy-of select="umbraco.library:GetXmlNodeById(.)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="nodes" select="msxml:node-set($preNodes)/*[@isDoc]" />
<xsl:if test="count($nodes) > 0">
<xsl:for-each select="$nodes">
<xsl:variable name="mediaId" select="number(monthOfferImage)" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img>
<xsl:attribute name="src">
<xsl:text>/ImageGen.ashx?image=</xsl:text>
<xsl:value-of select="$mediaNode/umbracoFile" />
<xsl:text>&height=130</xsl:text>
<xsl:text>&compression=95</xsl:text>
<xsl:text>&constrain=true</xsl:text>
</xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="$mediaNode/@nodeName" /></xsl:attribute>
</img>
</xsl:if>
</xsl:if>
<h5>
<xsl:variable name="monthOfferLink" select="monthOfferLink" />
<xsl:if test="$monthOfferLink!= ''">
<a href="{umbraco.library:NiceUrl($monthOfferLink)}"> <xsl:value-of select="monthOfferHeadline"/>
</a>
</xsl:if>
</h5>
<xsl:value-of select="monthOfferText" disable-output-escaping="yes"/>
<xsl:variable name="monthOfferLink" select="monthOfferLink" />
<xsl:if test="$monthOfferLink!= ''">
<a class="arrowTextLink" href="{umbraco.library:NiceUrl($monthOfferLink)}">
Läs mer
</a>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:template>
</code>
Hi Niklas,
I do not know if it will solve your problem but maybe. I know that it is possible to put an attribute on your macro.
The attribute is called recursive and has the value true. So maybe you could try something like this.
I have not tried myself so I do not know if it will solve your issues.
But hope it helps you.
/Dennis
is working on a reply...