Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • thanhtien501 28 posts 48 karma points
    Nov 01, 2010 @ 03:31
    thanhtien501
    0

    list page of the first child

    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

     -- 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.

     

  • Kasper Dyrvig 246 posts 379 karma points
    Nov 01, 2010 @ 22:26
    Kasper Dyrvig
    0

    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() &lt;= '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!

  • thanhtien501 28 posts 48 karma points
    Nov 03, 2010 @ 08:40
    thanhtien501
    0

    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

  • Kasper Dyrvig 246 posts 379 karma points
    Nov 03, 2010 @ 09:10
    Kasper Dyrvig
    0

    What version of Umbraco do you use?

  • thanhtien501 28 posts 48 karma points
    Nov 03, 2010 @ 09:27
    thanhtien501
    0

    I use 4.6 alpha ( umbraco 4.6 - codename JUNO)


  • Kasper Dyrvig 246 posts 379 karma points
    Nov 03, 2010 @ 13:30
    Kasper Dyrvig
    0

    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() &lt;= '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]">
  • thanhtien501 28 posts 48 karma points
    Nov 03, 2010 @ 19:57
    thanhtien501
    0

    Thank you for you enthusiasm . it works.

     

  • Kasper Dyrvig 246 posts 379 karma points
    Nov 04, 2010 @ 08:17
    Kasper Dyrvig
    0

    Please mark witch post was the answer to your problem... :-)

  • thanhtien501 28 posts 48 karma points
    Nov 04, 2010 @ 13:10
    thanhtien501
    0

    2 ways are ok.

Please Sign in or register to post replies

Write your reply to:

Draft