I have multiple embedded contents merged together in one list (lists of testimonials, combined to form one list) and I just want randomise the order of the files. heres my current code.
@using umbraco.MacroEngines; @{ foreach(var testamonial in Model.Children) { var itemsList = testamonial.customerTestimonials; <ul> @foreach(var item in itemsList) { var customerItem = item.customer.InnerText; var testimonItem = item.testimonial.InnerText;
Sorting Multiple Embedded Contents randomly
I have multiple embedded contents merged together in one list (lists of testimonials, combined to form one list) and I just want randomise the order of the files. heres my current code.
I manage to develop the solution.
@using umbraco.MacroEngines; @{ if (Model.Where("showTestimonials")) { <section class="testimonials"> <h2>Testimonials</h2>@foreach(var testamonial in Model.NodeById(1140).Children) { var itemsList = testamonial.customerTestimonials; <ul> @foreach (var item in itemsList) { var customerItem = item.customer.InnerText; var testimonItem = item.testimonial.InnerText;
int currentNodeInt = Model.Id; string showNode = item.alsoShow.InnerText; string currentNode = Convert.ToString(currentNodeInt);
if (showNode == currentNode { <li> <p>@testimonItem</p> <p class="quoter">@customerItem</p> </li> } } </ul> } </section> } }
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.