-
-
Save sniffdk/5457886 to your computer and use it in GitHub Desktop.
| // Typed | |
| var ids = Model.Content.GetPropertyValue<string>("mNTP", true, "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries); | |
| var items = Umbraco.TypedContent(ids); | |
| // Dynamic | |
| @if (CurrentPage.HasValue("mNTP", true)) | |
| { | |
| var ids = CurrentPage._mNTP.Split(','); | |
| var items = Umbraco.Content(ids); | |
| foreach (var item in items) | |
| { | |
| <p>@item.Name</p> | |
| } | |
| } |
As I wrote on Twitter, that example uses the old MacroEngines api, it seems it haven't been updated to the new IPublishedContent api. And yes, prefixing a property name, when using dynamic, will make the property recursive. Is there a reason why you won't make due with the code I provided? I'm not sure why you insist on using the old api? And I'm not sure what "does not work" means, could use a little more detail :)
I didn't say, I wouldn't use your solution. I'm just saying your snippet looks more complicated than the one provided by Umbraco itself and I want to understand what the problem is before I switch. And when I say it doesn't work I just mean the values for the properties are not used (banner doesn't show anywhere) when I use underscore.
Anyway, thank you for your help. I have now enough material to go on. I'll post back when I have a working solution.
This is the exact snippet that comes with Umbraco v6
@inherits umbraco.MacroEngines.DynamicNodeContext
Theoretically saying @node._Name should make it recursive (if I understand it correctly) but it does not work in my (very similary) code.