Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin Todd 15 posts 45 karma points
    Mar 12, 2013 @ 22:12
    Kevin Todd
    0

    Upgrade from 2.0 to 2.5 breaks macros

    Hello, we recently updates our DAMP from 2.0 to 2.5. This ended up breaking our gallery macro (working fine before the upgrade) and we cannot seem to figure out what the problem is. It appears that the property is not being seen as a list of anything. We are currently using Umbraco 6.0.2. 

    Our old code:

     

    @if (Model.HasValue("gallery")) {

     

    try 

    {

     

        dynamic mediaItems = Model.gallery.mediaItem;

     

        var count = 0;                             

     

        if (mediaItems.Count() != 0)

        {

     

            @:<div class="mediaGallery">    

     

            foreach (var item in mediaItems)

            {

     

                var image = item.Image;

                 if (count == 0) {

     

                   <a class="group1" href="@image.umbracoFile" title="@image.nodeName"><img src="@image.umbracoFile"></a>

                   <div class="galleryInstruc">

                     Click to see the gallery

                   </div>

                 } else {

                   <div style="display:none;">

                     <a class="group1" href="@image.umbracoFile" title="@image.nodeName">@image.nodeName</a>

                   </div>

                 }

     

               count++;

            }

     

             @:</div> <!-- mediaGallery -->

        }

    }

    catch(Exception ex)

    {

    throw ex;

    }

     

     

    Now, we get an error that says 'umbraco.MacroEngines.PropertyResult' does not contain a definition for 'MediaItem' . The gallery property is a DAMP datatype

    We have attempted going about it in a multitude of different ways but to no avail. Advice? 

    Thanks in advance and sorry if my formatting is poor. 

  • Kevin Todd 15 posts 45 karma points
    Mar 12, 2013 @ 22:29
    Kevin Todd
    0

    If it helps, the DAMP object appears to be just a String object and the image file paths, etc are outputted on screen in plain text using @Model.gallery .

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 13, 2013 @ 09:14
    Jeroen Breuer
    100

    Did you also upgrade from an older Umbraco version to 6.0.2? It seems this issue is fixed in the nightly, but not in 6.0.2: http://issues.umbraco.org/issue/U4-1824

    I think that's the problem you're having.

    Jeroen

  • Kevin Todd 15 posts 45 karma points
    Mar 13, 2013 @ 14:21
    Kevin Todd
    0

    That was indeed the problem. Thanks so much!

  • Gijs 38 posts 133 karma points
    Aug 27, 2013 @ 10:00
    Gijs
    0

    I have the same problem, but on 4.11.10

    There's no newer 4.x version to upgrade to, and upgrading to 6 isn't an option at this stage.

    What to do?

Please Sign in or register to post replies

Write your reply to:

Draft