Assuming I want to get all InfoItem and NewsItem documents, sort by date and return the to 5 items.
Combine with that - that the documents can hang at any level or off any node in the site..Is that possible?
Currently if i want to get all the NewsItems nodes - starting at the
websites root, i would use the following foreach loop (parent is set to
AncestorOrSelf(1)
foreach (var node in parent.DescendantsOrSelf("NewsItem").Take(5))
So I guess what i am looking for is something like
foreach (var node in parent.DescendantsOrSelf("NewsItem||InfoItem").OrderBy("docDate desc").Take(5))
(any other ideas as to how to pull this off would be appreciated also)
Get more than one document type?
Assuming I want to get all InfoItem and NewsItem documents, sort by date and return the to 5 items.
Combine with that - that the documents can hang at any level or off any node in the site..Is that possible?
Currently if i want to get all the NewsItems nodes - starting at the websites root, i would use the following foreach loop (parent is set to AncestorOrSelf(1)
So I guess what i am looking for is something like
(any other ideas as to how to pull this off would be appreciated also)
Thanks in advance.
Rob
Hi Rob,
I'd do something like this:
The GetPropertyValue is an extension method that wraps Node.GetProperty(Alias) with some null checking.
Hopefully this sets you in the right direction!
Nice!.. I will need to give it a try.
I ended up building something functional with a .net usercontrol, but if prefer the razor syntax when it works. (less of a deployment head ache)
Rob
is working on a reply...