I'm puzzeling with the Related Links data type... The goal is to view the content of the childs of currentPage. Some of the childs contains both external and internal links made with the Related Links data type. But in my foreach loop I can't get the links out.
I have tried to do it with a copy-of on a node that contains links, so I am sure that the markup code works. As far I can see the problem is in the if statenment checking if serviceRelated contains enything. But I'm not sure what to do to make it work?
Kasper, thats what i meant earlier, you could try creating an XSLT and use the choose Related Links from the drop down menu. And replaced your documentType Alias as you named it and placed it in your template.
Hi again Kasper, can you tell me what is the name of your DocumentType Alias you used for your Related Links?
If is the SERVICEVIDEOLINK then try making use of the XSLT Related Links already available under the Developer Section. You should get some code like that
<xsl:param name="currentPage"/> <!-- Input the related links property alias here --> <xsl:variable name="propertyAlias" select="string('links')"/> <xsl:template match="/">
If statement and Related Link
Hi all
I'm puzzeling with the Related Links data type... The goal is to view the content of the childs of currentPage. Some of the childs contains both external and internal links made with the Related Links data type. But in my foreach loop I can't get the links out.
I have tried to do it with a copy-of on a node that contains links, so I am sure that the markup code works. As far I can see the problem is in the if statenment checking if serviceRelated contains enything. But I'm not sure what to do to make it work?
Can some one help me out? Thanks
Hi Kasper
What you can try is create a XSLT under the developer section and try to add the Macros to you Template. Then just replace your documentType Alias
This worked for me.
Sorry I wasn’t clear enough... the code posted is from the xslt and it is placed in the template.
Kasper, thats what i meant earlier, you could try creating an XSLT and use the choose Related Links from the drop down menu. And replaced your documentType Alias as you named it and placed it in your template.
Okaaay... now I understand what you mean. I have done that now. But how can that help me? The result is no different...
My code now:
<xsl:for-each select="umbraco.library:GetXmlNodeById($subject)/* [@isDoc and umbracoNaviHide != 1 and @level = 6]">
<table cellpadding="0" cellspacing="0" class="serviceQATable" id="{@id}">
<tr class="serviceQ">
<td>Sprøgsmål</td>
<td><p><xsl:value-of select="serviceQuestion"/></p></td>
</tr>
<tr class="serviceA">
<td>Svar</td>
<td>
<xsl:value-of select="bodyText" disable-output-escaping="yes"/>
<p class="serviceGoto">
<xsl:for-each select="./* [name() = 'serviceRelates' and not(@isDoc)]/links/link">
<a>› <xsl:attribute name="href"><xsl:choose><xsl:when test="@type = 'internal'"><xsl:value-of select="umbraco.library:Replace(umbraco.library:NiceUrl(@link), '.aspx', '')"/></xsl:when><xsl:otherwise><xsl:value-of select="@link"/></xsl:otherwise></xsl:choose></xsl:attribute><xsl:value-of select="@title"/></a><br />
</xsl:for-each>
</p>
<xsl:if test="serviceVideolink != ''">
<p class="serviceGoto"><a class="serviceOpenVideo">› Se videoguide</a></p>
<div class="serviceVideo"><iframe width="550" height="343" src="http://www.youtube.com/embed/{serviceVideolink}?rel=0" frameborder="0"></iframe></div>
</xsl:if>
</td>
</tr>
</table>
</xsl:for-each>
Hi again Kasper, can you tell me what is the name of your DocumentType Alias you used for your Related Links?
If is the SERVICEVIDEOLINK then try making use of the XSLT Related Links already available under the Developer Section. You should get some code like that
Then here you can change your property alias to
See if you are getting the value you inserted in your Content Section, then just add all your other fields.
The docemnettype containing the Related links is called serviceRelates.
<xsl:for-each select="./* [name() = 'serviceRelates' and not(@isDoc)]/links/link">
<a>› <xsl:attribute name="href"><xsl:choose><xsl:when test="@type = 'internal'"><xsl:value-of select="umbraco.library:Replace(umbraco.library:NiceUrl(@link), '.aspx', '')"/></xsl:when><xsl:otherwise><xsl:value-of select="@link"/></xsl:otherwise></xsl:choose></xsl:attribute><xsl:value-of select="@title"/></a><br />
</xsl:for-each>
did you change this your variable propertyAlias to
Nooo... stupid me.
It turns out that the property is called serviceRelated, not serviceRelates. Now it works...
Thanks for your help and patience.
Hi Kasper,
Good you got it working :)
is working on a reply...