Copied to clipboard

Flag this post as spam?

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


  • Joe 7 posts 27 karma points
    Jul 02, 2013 @ 13:26
    Joe
    0

    DAMP - Load images

    Hi,

    I have a problem for lod several images with DAMP.

     

    try
      {
        <div id="slider" style="padding-left: 12px">
           <div id="ei-slider" class="ei-slider">
              <ul class="ei-slider-large">
                 @foreach (var list in Model.AncestorOrSelf(1).Descendants("ResultatsItem"))
                 {
                   foreach (var item in Model.photosDuMatch)
                     {
                        var image = Model.NodeById(list.photosDuMatch);
                        <li>
                             <img src="@image.Url" alt=""/>
                         </li>
                      }              
                  }
                </ul>
                <ul class="ei-slider-thumbs">
                   <li class="ei-slider-element">Current</li>
                  @foreach (var list in Model.AncestorOrSelf(1).Descendants("ResultatsItem"))
                      {
                          var image = Model.NodeById(list.photosDuMatch);
                          <li><a href="#">Slide 6</a><img src="@image.Url" alt="" /></li>
                       }
                  </ul><!-- ei-slider-thumbs -->
                </div> 
                <span class="shadowflat"><img src="/images/big-shadow3.png" alt="" /></span>
            </div>
     }
     catch
    {
    
    }




    This code work with one image but not work with two images. Thx.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jul 02, 2013 @ 15:19
    Jeroen Breuer
    0

    Hello,

    Why are you doing a foreach inside a foreach? Do you store the data as xml or id? It might be a good idea to have a look at these examples:

    DAMP 2.5 Samples: Video - http://www.screenr.com/gz0s

    DAMP Gallery: Video - http://www.screenr.com/1Vx7

    Jeroen

  • Joe 7 posts 27 karma points
    Jul 02, 2013 @ 15:29
    Joe
    0

    I viewed videos but it does not say to me why my code is bad.

    And I have to remove the foreach second.

     

    Thanks

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jul 02, 2013 @ 15:36
    Jeroen Breuer
    0

    Could you please post a part of your umbraco.config xml file so I can see how you store the DAMP data. Please make sure it's stored as full xml on the datatype.

    Jeroen

  • Joe 7 posts 27 karma points
    Jul 02, 2013 @ 15:39
    Joe
    0
    <ResultatsItem id="1303" parentID="1302" level="3" creatorID="0" sortOrder="0" createDate="2013-07-01T13:25:54" updateDate="2013-07-02T13:39:06" nodeName="Equipe A" urlName="equipe-a" path="-1,1076,1302,1303" isDoc="" nodeType="1300" creatorName="admin" writerName="admin" writerID="0" template="1301">
            <umbracoUrlName />
            <umbracoUrlAlias />
            <umbracoRedirect />
            <umbracoNaviHide>0</umbracoNaviHide>
            <metaDescription><![CDATA[]]></metaDescription>
            <metaKeywords><![CDATA[]]></metaKeywords>
            <score>SC *** 2-1 ***</score>
            <resume><![CDATA[<div class="description">
    <p></p>
    </div>]]></resume>
            <date>Dim. 23 Juin 13 - 15h00</date>
            <journee>*** - 22ème journée</journee>
            <photosDuMatch>1216</photosDuMatch>
            <calendrier>http://www.fff.fr/la-vie-des-clubs/***/calendrier/***-a-venir/283517</calendrier>
            <classement>http://www.fff.fr/la-vie-des-clubs/***/page-classement/***-283517/phase-1/groupe-1</classement>
          </ResultatsItem>
  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jul 02, 2013 @ 15:46
    Jeroen Breuer
    0

    Could you store the data as full xml? You need to change it in the datatype and save the page again. The xml should look different after that.

    Jeroen

  • Joe 7 posts 27 karma points
    Jul 02, 2013 @ 16:02
    Joe
    0
    <ResultatsItem id="1303" parentID="1302" level="3" creatorID="0" sortOrder="0" createDate="2013-07-01T13:25:54" updateDate="2013-07-02T16:13:56" nodeName="Equipe A" urlName="equipe-a" path="-1,1076,1302,1303" isDoc="" nodeType="1300" creatorName="admin" writerName="admin" writerID="0" template="1301">
            <umbracoUrlName />
            <umbracoUrlAlias />
            <umbracoRedirect />
            <umbracoNaviHide>0</umbracoNaviHide>
            <metaDescription><![CDATA[]]></metaDescription>
            <metaKeywords><![CDATA[]]></metaKeywords>
            <score>SC *** 2-1 ***</score>
            <resume><![CDATA[<div class="description">
    <p></p>
    </div>]]></resume>
            <date>Dim. 23 Juin 13 - 15h00</date>
            <journee>*** - 22ème journée</journee>
            <photosDuMatch><![CDATA[<DAMP fullMedia="">
      <mediaItem>
        <Image id="1216" version="f25e385f-7a2d-4203-a6d9-68a82a4d60f2" parentID="1288" level="4" writerID="0" nodeType="1032" template="0" sortOrder="0" createDate="2013-06-24T13:10:52" updateDate="2013-06-25T14:58:33" nodeName="Parcdessports" urlName="parcdessports" writerName="admin" nodeTypeAlias="Image" path="-1,1164,1190,1288,1216">
          <umbracoFile>/media/860/parcdessports.jpg</umbracoFile>
          <umbracoWidth>2560</umbracoWidth>
          <umbracoHeight>1]]></photosDuMatch>
            <calendrier>http://www.fff.fr/la-vie-des-clubs/***/calendrier/liste-matchs-a-venir/283517</calendrier>
            <classement>http://www.fff.fr/la-vie-des-clubs/***/page-classement/competition-283517/phase-1/groupe-1</classement>
          </ResultatsItem>
  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jul 02, 2013 @ 16:05
    Jeroen Breuer
    0

    Something like this should probably work now:

    foreach (var item in Model.photosDuMatch)
    {
        var image = item.Image;
        <li>
            <img src="@image.umbracoFile" alt="@image.nodeName"/>
        </li>
    }

    Jeroen

  • Joe 7 posts 27 karma points
    Jul 02, 2013 @ 16:16
    Joe
    0

    Not work ! That does not work as a media Picker?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jul 02, 2013 @ 16:21
    Jeroen Breuer
    0

    Is your Model the current page and does that current page have the photosDuMatch property? What version of Umbraco are you using?

    Jeroen

  • Joe 7 posts 27 karma points
    Jul 02, 2013 @ 16:28
    Joe
    0

    Umbraco v6.0.2

     

    I have just seen that when I select an image and what I back up, I return then on my page the image is not there any more.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jul 02, 2013 @ 16:33
  • Joe 7 posts 27 karma points
    Jul 02, 2013 @ 16:42
    Joe
    0

    There is another means to load several embellish with images without having to ask them one by one with a media to picker?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jul 02, 2013 @ 16:47
    Jeroen Breuer
    0

    You could select a media folder and display the content of the folder. I do the same thing on this page which is also in the DAMP Gallery.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft