x First time here? Check out the FAQ

Come work for Umbraco - The Umbraco HQ are hiring Project managers, .NET developers and DevOps people!

  • Avatar1197posts2044karma
    Comment with ID: 101603
    Anthony Candaele posted this reply January 2, 2012 @ 06:14

    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<DynamicNodepostList uBlogsy.Web.Helpers.NodeHelper.GetPosts(1107);

    IEnumerable<DynamicNodenodes;

    nodes postList.Take(count);

    @foreach (var in nodes)

    {

    dynamic file @n.uBlogsyPostImage.mediaItem.NewsImage

    }


  • Jeroen Breuer posted this reply January 2, 2012 @ 06:19

    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


  • Avatar1197posts2044karma
    Comment with ID: 101605
    Anthony Candaele posted this reply January 2, 2012 @ 06:23

    Good news, I found it:

    @foreach (dynamic in nodes)
                    {
                        dynamic file @n.uBlogsyPostImage.mediaItem.NewsImage;                   
                        <li>
                            @if(file.HasValue())
                            {
                            <img src="@file.umbracoFile" />
                            }
                           
                            <href="@n.Url">
                            @n.GetProperty("uBlogsyContentTitle").Value
                            </a>
                           
                        </li>
                    }

    Thanks for your help,

    Anthony


  • Jeroen Breuer posted this reply January 2, 2012 @ 06:27

    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>
    }

    Jeroen


  • Avatar1197posts2044karma
    Comment with ID: 101609
    Anthony Candaele posted this reply January 2, 2012 @ 06:41

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


  • Avatar1197posts2044karma
    Comment with ID: 101612
    Anthony Candaele posted this reply January 2, 2012 @ 07:01

    and also the date problem is solved:

    @n.uBlogsyPostDate.ToString("d MMMM yyyy")

    This makes my news solution using uBlogsy and DAMP complete:



Pages:

Please login or Sign up To post replies