Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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.
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
I viewed videos but it does not say to me why my code is bad.And I have to remove the foreach second.
Thanks
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.
<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>
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.
<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>
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> }
Not work ! That does not work as a media Picker?
Is your Model the current page and does that current page have the photosDuMatch property? What version of Umbraco are you using?
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.
If you're using v6 I strongly recommand to use the new Razor instead of the old razor. More info here: http://our.umbraco.org/projects/backoffice-extensions/digibiz-advanced-media-picker/digibiz-advanced-media-picker/39627-How-to-detect-if-no-items-have-been-picked#comment144735
So use MVC templates: http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx
If you do that the DAMP gallery is a great example: http://24days.in/umbraco/2012/damp-gallery/
There is another means to load several embellish with images without having to ask them one by one with a media to picker?
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.
is working on a reply...
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.
Continue discussion
DAMP - Load images
Hi,
I have a problem for lod several images with DAMP.
This code work with one image but not work with two images. Thx.
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
I viewed videos but it does not say to me why my code is bad.
And I have to remove the foreach second.
Thanks
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
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
Something like this should probably work now:
Jeroen
Not work ! That does not work as a media Picker?
Is your Model the current page and does that current page have the photosDuMatch property? What version of Umbraco are you using?
Jeroen
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.
If you're using v6 I strongly recommand to use the new Razor instead of the old razor. More info here: http://our.umbraco.org/projects/backoffice-extensions/digibiz-advanced-media-picker/digibiz-advanced-media-picker/39627-How-to-detect-if-no-items-have-been-picked#comment144735
So use MVC templates: http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx
If you do that the DAMP gallery is a great example: http://24days.in/umbraco/2012/damp-gallery/
Jeroen
There is another means to load several embellish with images without having to ask them one by one with a media to picker?
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
is working on a reply...
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.