Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm wondering how I can get the the last three modified nodes from my site. I want to go through the whole site tree and display the newest content in a list.
Any ideas?
Stefan
Try this
http://our.umbraco.org/forum/developers/xslt/7531-Select-top-10-ordered-by-child-node-count
If you want Razor (why would you not ;-) you could try this:
@{ umbraco.MacroEngines.DynamicNodeList list = Model.AncestorOrSelf().DescendantsOrSelf(); var newest = list.Items.OrderByDescending(x => x.UpdateDate).Take(3); foreach(dynamic item in newest){ <ul> <li>@item.Name li> <ul> }}
In this case you lose the 'dynamic' of the DynamicNode though, because of the cast to DynamicNodeList.
There is some bug in the DynamicNode OrderBy which makes it impossible to use:
var newest = @Model.AncestorOrSelf().DescendantsOrSelf().OrderBy("updateDate desc").Take(3);
This gives you just the first 3 items , not ordered by updateDate at all.
Cheers!
Richard
Thank you very much Richard :)
Hi some Idea How I can do this sort of last modified nodes with a xslt function ??
Thanks.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to get top3 last modified nodes
Hi,
I'm wondering how I can get the the last three modified nodes from my site. I want to go through the whole site tree and display the newest content in a list.
Any ideas?
Stefan
Try this
http://our.umbraco.org/forum/developers/xslt/7531-Select-top-10-ordered-by-child-node-count
If you want Razor (why would you not ;-) you could try this:
@{
umbraco.MacroEngines.DynamicNodeList list = Model.AncestorOrSelf().DescendantsOrSelf();
var newest = list.Items.OrderByDescending(x => x.UpdateDate).Take(3);
foreach(dynamic item in newest){
<ul>
<li>@item.Name li>
<ul>
}
}
In this case you lose the 'dynamic' of the DynamicNode though, because of the cast to DynamicNodeList.
There is some bug in the DynamicNode OrderBy which makes it impossible to use:
var newest = @Model.AncestorOrSelf().DescendantsOrSelf().OrderBy("updateDate desc").Take(3);
This gives you just the first 3 items , not ordered by updateDate at all.
Cheers!
Richard
Thank you very much Richard :)
Hi some Idea How I can do this sort of last modified nodes with a xslt function ??
Thanks.
is working on a reply...