Copied to clipboard

Flag this post as spam?

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


  • andles 44 posts 64 karma points
    Aug 11, 2010 @ 14:47
    andles
    0

    Display only last 10 nodes

    I am adding nodes to a parent node dynamically - theere could potentially be hundreds. What I woudl like to do is show only the last 10 nodes added, but include a last node that reads "More..." which will link off to a full listing.

    If anyone has any ideas I woudl appreciate it - while I have a solution I am using it seems rather lengthy and hackish.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Aug 11, 2010 @ 14:51
    Matt Brailsford
    0

    Something like this could work:

    <xsl:for-each select="...">
     
    <xsl:if test="position()) &lt;= 10 or umbraco.library:RequestQueryString('show') = 'all'">
       ...
     
    </xsl:if>
    </xsl:for-each>

    You'll need to add your select statement, and what to do with the results, but this should show the top 10 nodes, or all if the querystring ?show=all is present.

    Matt

  • andles 44 posts 64 karma points
    Aug 11, 2010 @ 15:00
    andles
    0

    Thanks Matt - does this apply to the Umraco Admin area? I am talking about nodes in the content section - so not sure how (where) I could use the above XSLT?

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Aug 11, 2010 @ 15:06
    Matt Brailsford
    0

    Ahhhh, my appologies, I miss read your question.

    I'm not sure what you are wanting to do then is possible (or at least not easy).

    My best suggestion would be either to use something like the AutoFolders package which can automatically sort your nodes into sub folders, making it much easier to manage. Or, I'd look into the jQuery used by the trees and see if you can extend that to only show X many nodes. I'm not sure of the link, but I know @slace posted somewhere about achiving a fake sort by only modifying the trees javascript, so there should be a way to hook into it.

    Matt

  • andles 44 posts 64 karma points
    Aug 12, 2010 @ 02:37
    andles
    0

    Thanks Matt - auto folders sounds promising, and I expect (hope!) I can use some JQuery to sort the "More..." requirment (maybe display the last 11, but hi-jack the11th node with the "More..." link / text. Though maybe auto folders will negate the need for this.

     

     

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 12, 2010 @ 05:28
    Aaron Powell
    0

    Yeah AutoFolders is what I'd go with, even with the current tree it's not really possible to do the kind of lazy-loading you sound like you're after.

    The thing I think Matt is referring to is I worked out a way to show the nodes in a fake order, but it would still show all of them. I used it in a talk I gave at DDD Melbourne: http://www.aaron-powell.com/dddmelbourne-umbraco

Please Sign in or register to post replies

Write your reply to:

Draft