Search In
Learn from 350 other Umbracians at the annual Umbraco Conference - CodeGarden '13. More than twenty high quality sessions, open spaces, hackathons and social events you'll remember. Not to be missed! Less than 25 tickets left - get yours now!
yes, n (documenttype uBlogsyPost) has a property uBlogsyPostImage (of datatype Digibiz Advanced Media Picker).
I wonder if the problem could be related to the fact that the collection is of type DynamicNode:
IEnumerable<DynamicNode> postList = uBlogsy.Web.Helpers.NodeHelper.GetPosts(1107);
IEnumerable<DynamicNode> nodes;
nodes = postList.Take(count);
@foreach (var n in nodes)
{
dynamic file = @n.uBlogsyPostImage.mediaItem.NewsImage;
}
You shouln't use the second @ there. Perhaps that is the problem. Do some little experiments :-).
@foreach (var n in nodes) { dynamic file = n.uBlogsyPostImage.mediaItem.NewsImage; }
Jeroen
Good news, I found it:
@foreach (dynamic n in nodes) { dynamic file = @n.uBlogsyPostImage.mediaItem.NewsImage; <li> @if(file.HasValue()) { <img src="@file.umbracoFile" /> } <a href="@n.Url"> @n.GetProperty("uBlogsyContentTitle").Value </a> </li> }
Thanks for your help,
Anthony
Good that you found it. For the other properties you don't need to do .GetProperty. This should also work:
@foreach (dynamic n in nodes) { dynamic file = @n.uBlogsyPostImage.mediaItem.NewsImage; <li> @if(file.HasValue()) { <img src="@file.umbracoFile" /> } <a href="@n.Url"> @n.uBlogsyContentTitle </a> </li> }
yes, as I'm not using
@foreach (DynamicNode n in nodes)
but
@foreach (dynamic n in nodes)
the @n.GetProperty("propertyalias").Value is not necessary
The only thing I'm still looking for is to format my blogpostdate:
@n.uBlogsyPostDate
As the syntax for the former DynamicNode doesn't work anymore:
@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d MMMM yyyy")
After this, the integration of Digibiz Advanced Media Picker and uBlogsy will be a fact :)
and also the date problem is solved:
@n.uBlogsyPostDate.ToString("d MMMM yyyy")
This makes my news solution using uBlogsy and DAMP complete: