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
I have various news sections on a site. I want to pull all the nodes of Document Type "NewsItem" together a main news page. I can work out how to do this. It seems to me that
@Model.Ancestors().Where("nodeTypeAlias = 'NewsItem'")
should work. But, it doesn't
You're almost there! Try:
@Model.Ancestor().Descendants("NewsItem")
Hmm I must be doing something else wrong
@inherits umbraco.MacroEngines.DynamicNodeContext@{ var news_items = @Model.Ancestor().Descendants("NewsItem"); <ul> @foreach (var news_item in news_items) { <li> @news_item.Name </li> } </ul>}
Copy/paste madness. That's (kinda) my code.
Such a change just as I was geting used to xslt
Ah, unfortunately in 4.7.0 it seems you need to use AncestorOrSelf() instead of Ancestor(). This will be corrected in the upcoming 4.7.1.
Thank you very much
Is there a way to get the NodeType ID instead of the NodeTypeAlias?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get all nodes of a specifice document type
I have various news sections on a site. I want to pull all the nodes of Document Type "NewsItem" together a main news page. I can work out how to do this. It seems to me that
should work. But, it doesn't
You're almost there! Try:
Hmm I must be doing something else wrong
Copy/paste madness. That's (kinda) my code.
Such a change just as I was geting used to xslt
Ah, unfortunately in 4.7.0 it seems you need to use AncestorOrSelf() instead of Ancestor(). This will be corrected in the upcoming 4.7.1.
Thank you very much
Is there a way to get the NodeType ID instead of the NodeTypeAlias?
is working on a reply...