Skip to content

Instantly share code, notes, and snippets.

@sniffdk
Last active December 16, 2015 15:39
Show Gist options
  • Save sniffdk/5457886 to your computer and use it in GitHub Desktop.
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>
}
}
@sniffdk
Copy link
Author

sniffdk commented Apr 25, 2013

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 :)

@mariaannalind
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment