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
Dear All
I have a tree structure look like below:
Home --News ------News1 ------News2 ------News3 ------News4 --Some Other stuff -----Some Other stuff1 -----Some Other stuff1
I want to list all the page is the child node of the News( the first child of the Root HOME)
I write a code below
<xsl:for-each select="$currentPage/child::node[position=1]/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:sort select="@updateDate" order="ascending" /> <h3 class="headline"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </h3> <small class="meta">Posted: <xsl:value-of select="umbraco.library:LongDate(@updateDate, true(), ' - ')"/></small><br/> <p class="introduction"> <xsl:value-of select="umbraco.library:ReplaceLineBreaks(introduction)" disable-output-escaping="yes"/> </p>
But maybe it does run as i am expected.
Add: In case i want to show page paging( 3 news only / page )
such as
Home
-- news 1:intro of news 1
<next>
Please help me, i really a newbie in umbraco as well as the xslt
Thank for your patience.
Hi thanhtien501 and sorry for the time you had to wait.
Here is some code to get you startet (I don't have a solution for the paging-issue):
<ul> <xsl:for-each select="umbraco.library:GetXmlNodeById('1103')//NewsItem[@isDoc and umbracoNaviHide != '1']"> <xsl:sort select="@updateDate" order="descending" /> <xsl:if test="position() <= '5'"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:if> </xsl:for-each> </ul>
The code marked with bold, you need to change so it matches your setup. "1103" should be the News page's ID. "NewsItem" must be the alias of the news item's document type.
I hope you can use it!
Hi
Thank for your reply.
I do the same what you said in your post but the result is nothing.
+ The 1103 is the ID of the News Page in my application.
+The NewsItems is the alias of the child-node of the news Page( in this context , it is the Document Type of the News1, news2. .... )
Do i understand right?
Please help me , thank you so much
What version of Umbraco do you use?
I use 4.6 alpha ( umbraco 4.6 - codename JUNO)
Ehm... okay (never heard of it)
Well, instead of search for the documenttype, you can try to just take every child node of your News page.
<ul> <xsl:for-each select="umbraco.library:GetXmlNodeById('1103')/* [@isDoc and umbracoNaviHide != '1']"> <xsl:sort select="@updateDate" order="descending" /> <xsl:if test="position() <= '5'"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </li> </xsl:if> </xsl:for-each> </ul>
If it still doesn't work try to remove the umbracoNaviHide:
<xsl:for-each select="umbraco.library:GetXmlNodeById('1103')/* [@isDoc]">
Thank you for you enthusiasm . it works.
Please mark witch post was the answer to your problem... :-)
2 ways are ok.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
list page of the first child
Dear All
I have a tree structure look like below:
I want to list all the page is the child node of the News( the first child of the Root HOME)
I write a code below
But maybe it does run as i am expected.
Add: In case i want to show page paging( 3 news only / page )
such as
Home
-- news 1:intro of news 1
-- news 1:intro of news 1
-- news 1:intro of news 1
<next>
Please help me, i really a newbie in umbraco as well as the xslt
Thank for your patience.
Hi thanhtien501 and sorry for the time you had to wait.
Here is some code to get you startet (I don't have a solution for the paging-issue):
<ul>
<xsl:for-each select="umbraco.library:GetXmlNodeById('1103')//NewsItem[@isDoc and umbracoNaviHide != '1']">
<xsl:sort select="@updateDate" order="descending" />
<xsl:if test="position() <= '5'">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
</ul>
The code marked with bold, you need to change so it matches your setup. "1103" should be the News page's ID. "NewsItem" must be the alias of the news item's document type.
I hope you can use it!
Hi
Thank for your reply.
I do the same what you said in your post but the result is nothing.
+ The 1103 is the ID of the News Page in my application.
+The NewsItems is the alias of the child-node of the news Page( in this context , it is the Document Type of the News1, news2. .... )
Do i understand right?
Please help me , thank you so much
What version of Umbraco do you use?
I use 4.6 alpha ( umbraco 4.6 - codename JUNO)
Ehm... okay (never heard of it)
Well, instead of search for the documenttype, you can try to just take every child node of your News page.
If it still doesn't work try to remove the umbracoNaviHide:
Thank you for you enthusiasm . it works.
Please mark witch post was the answer to your problem... :-)
2 ways are ok.
is working on a reply...