Copied to clipboard

Flag this post as spam?

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


  • Inmedia 124 posts 176 karma points
    Mar 10, 2011 @ 14:19
    Inmedia
    0

    Listing news...

    Hi everyone

    I have create a newslist for a clients website. The neslist shows a max amount of news, so only the 4 newest items get displayed... And it works fine, the news get displayed correctly...

    But I want it to NOT include the newest item (it has to be displayed by another macro i made).

    My XSLT looks like this...

    <xsl:param name="currentPage"/>
        <xsl:variable name="maxItems" select="/macro/maxItems"/>

    <xsl:template match="/">

    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
      <xsl:sort select="@createDate" order="ascending" />
      <xsl:if test="position() &gt;= $maxItems">
      

    <div class="box border">
                <h1><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></h1>
                <xsl:value-of select="newsTeaser"/>
    </div>


      </xsl:if>
    </xsl:for-each>
    </xsl:template>

     

    Can anyone help me out how to accomplish this?

     

    Kind regards

    Mikkel

  • Inmedia 124 posts 176 karma points
    Mar 10, 2011 @ 14:43
    Inmedia
    0

     

    There is an error in the XSLT above...

    The "Sort" and "if" statements should look like this:


    <xsl:sort select="@createDate" order="descending" />
      <xsl:if test="position() &lt;= $maxItems">

     

    I still havent solved my issue with NOT showing the NEWEST item...

     

    Kind regards

    Mikkel

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 10, 2011 @ 14:46
    Tom Fulton
    0

    Hi Mikkel,

    To skip the first item in the for-each  loop you could try:

    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1'][position() &gt; 1]">

    Thanks,
    Tom

  • Inmedia 124 posts 176 karma points
    Mar 10, 2011 @ 15:15
    Inmedia
    0

     

    Works like a charm... I knew it was a simple change somehow :)

    Thank you so much, Tom

     

    Kind regards

    Mikkel

Please Sign in or register to post replies

Write your reply to:

Draft