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
Hey im having difficulty getting a siblings page child elements, im trying to show all of child elements of 2011 in my archive, any suggestions?
----2011---------- 1---------- 2---------- 3----archive
ThanksGraeme
Hi Graeme,
One possible way of doing it would be inserting a macro in your Archive template page where you will display all the child nodes of 2011.
Something like that should get you working
<xsl:variable name="source" select="nodeId"/> <!-- 2011 NodeID --><xsl:template match="/"><ul><xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}" ><xsl:value-of select="@nodeName"/></a> </li></xsl:for-each> </ul> </xsl:template>
But bare in mind if you change the id of this node "2011" you will also need to change it in your xslt.
If not you can just Add some paramates in your macros with Alias "Source" name: "Source" type: Content Picker" and your XSLT
<xsl:variable name="source" select="/macro/source"/>
Then just add the Macro in your template and choose the node from which you want to display the siblings.
hope this will help
If you've got your nodes structured with different doctypes, in a structure somewhat like this:
--News [docType: ContentFolder]----2011 [docType: YearFolder]------1 [docType: NewsItem]------2 [docType: NewsItem]------3 [docType: NewsItem]
...then something like this should do it, in the XSLT for your archive page:
<xsl:apply-templates select="$currentPage/ancestor::ContentFolder[@nodeName='News']/YearFolder"/><xsl:template match="YearFolder"> <h2><xsl:value-of select="@nodeName"/></h2> <xsl:apply-templates select="NewsItem"> <xsl:sort select="@createDate" order="descending"/> </xsl:apply-templates></xsl:template><xsl:template match="NewsItem"> <li> <a href="{umbraco.library:NiceUrl(@id)}" ><xsl:value-of select="@nodeName"/></a> </li></xsl:template>
...and of course wrap a <ul></ul> around those list items :)
Thanks guys, i used Fujis method to solve the problem. Thanks for the feedback as well Dan, I'm going to use your solution for something else.
thanks again
Good you got it working Graeme.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get siblings child elements
Hey im having difficulty getting a siblings page child elements, im trying to show all of child elements of 2011 in my archive, any suggestions?
Thanks
Graeme
Hi Graeme,
One possible way of doing it would be inserting a macro in your Archive template page where you will display all the child nodes of 2011.
Something like that should get you working
<xsl:variable name="source" select="nodeId"/> <!-- 2011 NodeID -->
<xsl:template match="/">
<ul>
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}" ><xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
But bare in mind if you change the id of this node "2011" you will also need to change it in your xslt.
If not you can just Add some paramates in your macros with Alias "Source" name: "Source" type: Content Picker" and your XSLT
<xsl:variable name="source" select="/macro/source"/>
Then just add the Macro in your template and choose the node from which you want to display the siblings.
hope this will help
If you've got your nodes structured with different doctypes, in a structure somewhat like this:
...then something like this should do it, in the XSLT for your archive page:
...and of course wrap a <ul></ul> around those list items :)
Thanks guys, i used Fujis method to solve the problem. Thanks for the feedback as well Dan, I'm going to use your solution for something else.
thanks again
Good you got it working Graeme.
is working on a reply...