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...
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.
Continue discussion
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...
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.