Copied to clipboard

Flag this post as spam?

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


  • loic ponchon 36 posts 56 karma points
    Sep 05, 2011 @ 14:35
    loic ponchon
    0

    Get the parameter urlName from media for a macro

    Hello, i'm trying to get a parameter "urlName" from media, and display it by a razor macro

    So i got my umbraco config like this, and what's in bold is what i want

    <DAMP fullMedia="">

                  <mediaItem>

                    <MultipleImage id="1135" version="6f8a3e4f-a557-4e6f-a7d9-216cead8e183" parentID="1122" level="3" writerID="0" nodeType="1134" template="0" sortOrder="1" createDate="2011-09-05T12:12:29" updateDate="2011-09-05T12:12:30" nodeName="Paysage" urlName="paysage" writerName="Admin" nodeTypeAlias="MultipleImage" path="-1,1121,1122,1135">

                      <image>/media/286/chrysanthemum.jpg</image>

                    </MultipleImage>

                  </mediaItem>

                </DAMP>

    My macro looks like this :

    @{
        dynamic mediaItem = new umbraco.MacroEngines.DynamicMedia(Parameter.photoId);
    }
    <div>
    <img src="@mediaItem.Image"/>
    <p>@mediaItem.urlName</p>
    </div>

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies