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 the code below which is looping through folders and generating some markup from properties on the items beneath. How would I go about wrapping every ten blocks of the markup in a new Div?
Thanks for your help!
Amir
@foreach (var node in Model.Descendants().Where("Visible").Where("Level == 4").OrderBy("SortOrder desc")) { <div class="galleryThumbMosaic-block galleryThumb-bar"> <a class="mosaic-overlay" href="@node.Url"> <div class="galleryThumb-details"> <h2 class="projectTitle">@Library.Coalesce(node.navigationDisplayName, node.Name)</h2> <span class="projectDate">@node.projectDate</span><span class="projectCategory">@node.Parent.Name</span><span class="projectPlus">+</span> </div> </a> <div href="#" class="mosaic-backdrop"><img src="@node.Media("thumbnailImage","umbracoFile")" width="240" height="150" alt="@node.Name"></div> </div>}
would somethign like this do the trick???
<div>@{int i = 0;foreach (var node in Model.Descendants().Where("Visible").Where("Level == 4").OrderBy("SortOrder desc")) {if ((i % 10) == 0) {@:</div><div>}<div class="galleryThumbMosaic-block galleryThumb-bar"><a class="mosaic-overlay" href="@node.Url"><div class="galleryThumb-details"><h2 class="projectTitle">@Library.Coalesce(node.navigationDisplayName, node.Name)</h2><span class="projectDate">@node.projectDate</span><span class="projectCategory">@node.Parent.Name</span><span class="projectPlus">+</span></a><div href="#" class="mosaic-backdrop"><img src="@node.Media("thumbnailImage","umbracoFile")" width="240" height="150" alt="@node.Name"></div></div>i++;}}</div>
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
Add div every nth item
Hi,
I have the code below which is looping through folders and generating some markup from properties on the items beneath. How would I go about wrapping every ten blocks of the markup in a new Div?
Thanks for your help!
Amir
would somethign like this do the trick???
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.