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 13, 2011 @ 14:21
    loic ponchon
    0

    Get media Id

    Hi i'm trying to get the media Id but it doesn't work

    @foreach (dynamic video in Model.video)

        {         <p>@video.id</p>         //dynamic mediaItem = new umbraco.MacroEngines.DynamicMedia(@video.id);         <div style="width:100pxheight:100pxfloat:lefttext-align:center;">             <a href="@video.Video.video"><img src="@video.Video.imageHeader" width="80" height="80" alt="@*@video.Video.Url*@" /></a>             <p>@*@video.Video.Name*@</p>         </div>     } 

    I tried with Id ID etc ...

    <LibrariesVideo id="1163" parentID="1108" level="3" writerID="0" creatorID="0" nodeType="1160" template="1156" sortOrder="3" createDate="2011-09-13T11:11:27" updateDate="2011-09-13T11:27:56" nodeName="Videos" urlName="videos" writerName="Admin" creatorName="Admin" path="-1,1105,1108,1163" isDoc="">
            <imageHeader><![CDATA[1104]]></imageHeader>
            <LibrariesVideoDetails id="1186" parentID="1163" level="4" writerID="0" creatorID="0" nodeType="1161" template="1157" sortOrder="1" createDate="2011-09-13T12:32:27" updateDate="2011-09-13T14:09:23" nodeName="Bref" urlName="bref" writerName="Admin" creatorName="Admin" path="-1,1105,1108,1163,1186" isDoc="">
              <imageHeader><![CDATA[1185]]></imageHeader>
              <video>
                <DAMP fullMedia="">
                  <mediaItem>
                    <Video id="1194" version="c82c8dbc-0875-4995-8485-78668b377cdf" parentID="1173" level="3" writerID="0" nodeType="1193" template="0" sortOrder="1" createDate="2011-09-13T14:06:55" updateDate="2011-09-13T14:06:55" nodeName="Bref 1" urlName="bref1" writerName="Admin" nodeTypeAlias="Video" path="-1,1098,1173,1194">
                      <video />
                      <imageHeader>/media/448/kyanbis.jpg</imageHeader>
                    </Video>
                  </mediaItem>
                  <mediaItem>
                    <Video id="1196" version="b3a672a1-64b8-4cbe-ae71-d767d4ed14a4" parentID="1173" level="3" writerID="0" nodeType="1193" template="0" sortOrder="3" createDate="2011-09-13T14:07:11" updateDate="2011-09-13T14:07:11" nodeName="Bref 3" urlName="bref3" writerName="Admin" nodeTypeAlias="Video" path="-1,1098,1173,1196">
                      <video />
                      <imageHeader>/media/453/kyanbis.jpg</imageHeader>
                    </Video>
                  </mediaItem>
                  <mediaItem>
                    <Video id="1197" version="c0f26530-d11f-4264-a4c4-6a26c39d88a6" parentID="1173" level="3" writerID="0" nodeType="1193" template="0" sortOrder="3" createDate="2011-09-13T14:07:20" updateDate="2011-09-13T14:07:21" nodeName="Bref 2" urlName="bref2" writerName="Admin" nodeTypeAlias="Video" path="-1,1098,1173,1197">
                      <video />
                      <imageHeader>/media/455/kyanbis.jpg</imageHeader>
                    </Video>
                  </mediaItem>
                  <mediaItem>
                    <Video id="1198" version="ac4d614a-3e76-49ea-9170-e9a1bd0254fb" parentID="1173" level="3" writerID="0" nodeType="1193" template="0" sortOrder="4" createDate="2011-09-13T14:07:32" updateDate="2011-09-13T14:07:32" nodeName="Bref 4" urlName="bref4" writerName="Admin" nodeTypeAlias="Video" path="-1,1098,1173,1198">
                      <video />
                      <imageHeader>/media/457/kyanbis.jpg</imageHeader>
                    </Video>
                  </mediaItem>
                  <mediaItem>
                    <Video id="1199" version="63095a8e-e311-4419-a544-71729d8c9029" parentID="1173" level="3" writerID="0" nodeType="1193" template="0" sortOrder="5" createDate="2011-09-13T14:07:39" updateDate="2011-09-13T14:07:39" nodeName="Bref 5" urlName="bref5" writerName="Admin" nodeTypeAlias="Video" path="-1,1098,1173,1199">
                      <video />
                      <imageHeader>/media/459/kyanbis.jpg</imageHeader>
                    </Video>
                  </mediaItem>
                </DAMP>
              </video>
            </LibrariesVideoDetails>
          </LibrariesVideo>

    Thank you by advance

     

     

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 13, 2011 @ 14:30
    Sebastiaan Janssen
    0

    First of all, make sure to get umbraco.RazorEngines.dll from a recent nightly and put it in your /bin folder.

    Then something like this should work:

    @foreach (dynamic video in Model.Video.mediaItem) {
        <p>@video.id<p>
    }

    Note that the foreach is looping through Model.Video.mediaItem instead of through Model.Video.

  • loic ponchon 36 posts 56 karma points
    Sep 13, 2011 @ 14:42
    loic ponchon
    0

    Nop it doesn't work. Id doesn't exist as well before

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 14, 2011 @ 09:40
    Sebastiaan Janssen
    0

    I've just noticed that there's 2 <video> elements in there, might be the problem. Try renaming on of them to Media, or videoFile or something like that.

Please Sign in or register to post replies

Write your reply to:

Draft