Copied to clipboard

Flag this post as spam?

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


  • vaibhav 119 posts 139 karma points
    Mar 14, 2011 @ 09:41
    vaibhav
    0

    Xslt & templates for news feed

    Hello all

    I want to make 1 templates which will show news written by me ....

    If i add any new news then it should be shown along with old news ....

    ie. new news should be shown 1st & then old news should be shown 2nd....

    I am not understanding that how to make xslt & templates for this as i am quite new to umbraco ...

    So please help me in doing this .....

  • Rob Watkins 343 posts 593 karma points
    Mar 14, 2011 @ 11:37
    Rob Watkins
    0
    <xsl:for-each select="umbraco.library:GetXmlAll()//MyNewsItemDocType">
    <xsl:sort select="@updateDate" order="descending"/>
    <!-- display news items here -->
    </xsl:for-each>

    This will iterate all news item doctypes from across the site, sorted by last updated, with most recent first.

    If there is a "News Date" field on your doctype you can obviously use that instead of @updateDate.

    Here is a slight variation to only display 5 most recent items (useful on home pages for example):

    <xsl:for-each select="umbraco.library:GetXmlAll()//MyNewsItemDocType">
    <xsl:sort select="@updateDate" order="descending"/> <xsl:if test="position() &lt; 5">
    <!-- display news items here --> </xsl:if>
    </xsl:for-each>

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies