Currently we use the following script to make lists of events document types no matter where they appear in the content tree. We have a new event doc type (alias RecruitmentEvent) and so we now need this list to pick up both doc types - Eventspage and RecruitmentEvent.
I've tried changinging this line
var newsEvents = root.DescendantsOrSelf("Eventspage").ToList();
to:
var newsEvents = root.DescendantsOrSelf("Eventspage||RecruitmentEvent").ToList();
but that didn't work so I must be missing something! This is the full script we currently have:
@using umbraco.MacroEngines @inherits DynamicNodeContext @{ string tagToFind = Parameter.EventType; var root = Model.AncestorOrSelf(1); var newsEvents = root.DescendantsOrSelf("Eventspage").ToList();
@foreach (var item in newsEvents.Where("startDateAndTime >= @0", DateTime.Now.Date).OrderBy("startDateAndTime")) { string[] tags = item.tags.ToString().Split(','); if (tags.Contains(tagToFind)) {
Razor - how to list descendants from multiple lists and multiple doc types
HI there,
Currently we use the following script to make lists of events document types no matter where they appear in the content tree. We have a new event doc type (alias RecruitmentEvent) and so we now need this list to pick up both doc types - Eventspage and RecruitmentEvent.
I've tried changinging this line
var newsEvents = root.DescendantsOrSelf("Eventspage").ToList();
to:
but that didn't work so I must be missing something! This is the full script we currently have:
Hi Clare,
What if you try to change:
var newsEvents = root.DescendantsOrSelf("Eventspage").ToList();
To this:
So your full script would look like this.
Hope this helps,
/Dennis
Thanks so much Dennis, works perfectly!
is working on a reply...