Copied to clipboard

Flag this post as spam?

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


  • Tim Salter 17 posts 47 karma points
    Jan 15, 2012 @ 05:11
    Tim Salter
    0

    Sorting NewsListItems

    I am trying to sort the News Feed List under a News Area and am having difficulties. I changed the umbNewsFeedList.xslt file as follows:

    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
    <xsl:sort select="@sortOrder" order="ascending" />
    <h3 class="headline"> <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>

    by changing @updateDate to @sortOrder.

    It works for some of the News items, but not all. Does the @isDoc come into play? I have created a couple new documentTypes and Templates that are used under the News Area.

    Any help is appreciated.

    Thank you,

    Tim

  • Owen 123 posts 246 karma points
    Jan 15, 2012 @ 06:57
    Owen
    0

    I think the problem is caused by data, not your code. Because of "It works for some of the News items, but not all".

    Have a look at the file: ~/App_Data/umbraco.config, if the sorrOrder value is correct? 

    Might be you can republish the whole news items.

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 15, 2012 @ 07:41
    Fuji Kusaka
    0

    Hi Tim,

    Do you have any Date Time attached to your newsItem Page? In your xslt you could try to change this line from

    <xsl:sort select="@sortOrder" order="ascending" />

    to

     <xsl:sort select="current()/newsDate" order="ascending"/>

    Here the newsDate is another field you could add to your Document Type with type DatePicker.

  • Markus Johansson 1938 posts 5866 karma points MVP 2x c-trib
    Jan 15, 2012 @ 21:41
    Markus Johansson
    100

    Hi!

    I think this is becuse that the @SortOrder-parameter is treated as a string. You have to convert it into a number to get the correct result.

    <xsl:sortselect="@sortOrder"order="ascending"data-type="number"/>

  • Tim Salter 17 posts 47 karma points
    Jan 15, 2012 @ 22:19
    Tim Salter
    0

    @Markus - You rock!!  That was the issue.  Thank you very much.

    Thanks to Owen and Fuji for their responses.  It's very cool to have such a great community to learn from.

    Tim

Please Sign in or register to post replies

Write your reply to:

Draft