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
Hi,
I'm trying to extend the uBlogsyPostLists.cshtml script with an image property (uBlogsyPostImage).
I'm using DAMP and the normal way of acceccing images uploaded with DAMP is:
dynamic file = Model.uBlogsyPostImage.mediaItem.NewsImage; <img style="float:right;" src="/[email protected]&width=150" class="eventimage" />
But in the uBlogsyListPosts.cshtml I' don't have acces to .Model because I'm in a loop of DynamicNode:
@foreach (DynamicNode n in nodes)
{
...
}
So I try to access an the image property of my post like this
dynamic file = @n.Media("uBlogsyPostImage.mediaItem.NewsImage");
but this doesn't seem to work.
Does some has an idea how I can my image property on my uBlogsy post?
Thanks for your help,
Anthony
Can you change DynamicNode to var and try again?
Hi Sebastiaan,
First of all, I wish you lot's of happiness and a good health for 2012. And may we have lots of exciting times and succes in Umbraco land :)
Concerning the image, I tried your suggestion and changed DynamicNoe this code:
<ul class="list-2"> @foreach (var n in nodes) { dynamic file = @n.Media("uBlogsyPostImage.mediaItem.NewsImage"); <li> <img src="@file" /> <strong><span>@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d MMMM yyyy")</strong> <a href="@n.Url"> @n.GetProperty("uBlogsyContentTitle").Value </a> </li> } </ul>
but this just results in an empty tag:
thanks for your help,
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
extending uBlogsyPostLists.cshtml with image
Hi,
I'm trying to extend the uBlogsyPostLists.cshtml script with an image property (uBlogsyPostImage).
I'm using DAMP and the normal way of acceccing images uploaded with DAMP is:
dynamic file = Model.uBlogsyPostImage.mediaItem.NewsImage;
<img style="float:right;" src="/[email protected]&width=150" class="eventimage" />
But in the uBlogsyListPosts.cshtml I' don't have acces to .Model because I'm in a loop of DynamicNode:
@foreach (DynamicNode n in nodes)
{
...
}
So I try to access an the image property of my post like this
dynamic file = @n.Media("uBlogsyPostImage.mediaItem.NewsImage");
but this doesn't seem to work.
Does some has an idea how I can my image property on my uBlogsy post?
Thanks for your help,
Anthony
Can you change DynamicNode to var and try again?
Hi Sebastiaan,
First of all, I wish you lot's of happiness and a good health for 2012. And may we have lots of exciting times and succes in Umbraco land :)
Concerning the image, I tried your suggestion and changed DynamicNoe this code:
<ul class="list-2">
@foreach (var n in nodes)
{
dynamic file = @n.Media("uBlogsyPostImage.mediaItem.NewsImage");
<li>
<img src="@file" />
<strong><span>@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d MMMM yyyy")</strong>
<a href="@n.Url">
@n.GetProperty("uBlogsyContentTitle").Value
</a>
</li>
}
</ul>
but this just results in an empty tag:
thanks for your help,
Anthony
is working on a reply...