Forum
Repeater output in random order?
Client has requested a change to a part of a site that I have set up as a repeater to display the items in a random order.
Is this possible?
This is what the repeater template looks like if that's of any help:
<perch:repeater id="groups" label="Groups/Instructors">
<div class="contacts-linebreak"></div>
<div class="contacts-summary-wrap">
<perch:if exists="image">
<div class="contacts-thumb instructor">
<perch:if exists="website">
<a href='<perch:content id="website" type="text" label="Website"/>' class="contacts-summary-links" target="_blank">
</perch:if>
<img src='<perch:content type="image" id="image" label="Images" />' alt='<perch:content id="name" type="text" label="Name"/>' class="contacts-img"/>
<perch:if exists="website">
</a>
</perch:if>
</div>
</perch:if>
<div class='contacts-summary <perch:if exists="image">instructor</perch:if>'>
<h3 class="contacts-sub-title">
<perch:content id="name" type="text" label="Name"/>
</h3>
<div class="contacts-summary-text">
<perch:content id="summary" type="textarea" label="Summary" markdown="true" editor="markitup"/>
</div>
<div class="contacts-summary-details">
<perch:if exists="location">
Location: <span class="contacts-summary-location"><perch:content id="location" type="text" label="Location"/></span><br>
</perch:if>
<perch:if exists="telephone">
Telephone: <a href='tel:<perch:content id="telephone" type="text" label="Telephone"/>' class="contacts-summary-links">
<perch:content id="telephone" type="text" label="Telephone"/>
</a><br>
</perch:if>
<perch:if exists="email">
Email: <a href='mailto:<perch:content id="email" type="text" label="Email"/>' class="contacts-summary-links">
<perch:content id="email" type="text" label="Email"/>
</a><br>
</perch:if>
<perch:if exists="website">
Web: <a href='<perch:content id="website" type="text" label="Website"/>' class="contacts-summary-links" target="_blank">
<perch:content id="website" type="text" label="Website"/>
</a>
</perch:if>
</div>
</div>
</div>
</perch:repeater>
No, repeaters can only be sorted manually.
I believe that you can do random sorting on repeating regions using perch_content_custom.
Is there any straight-forward way of getting the content currently in repeaters into repeating regions, or am I looking at having to re-input everything into repeating regions?
By repeating region, are you talking about a multiple item region? If so then yes, you can sort those.
There's no way to migrate content. Repeaters are only really designed for small content snippets - like multiple images, for example. You wouldn't ever want to put large amounts of content into a repeater, that's not what they're for.
yeah, multiple item region.
OK. Guess that's all part of the learning curve then...