by
orbital » Wed Aug 11, 2021 11:43 pm
Hi SimonWpt and KK,
Let us note that repeatable regions are one of the best things about Couch CMS. They solve all sorts of tasks and are used very often.
Sometimes the repeatable region only needs to display one item - for example, the administrator can load several banners, but only one of them is displayed at the front end at random. This is easily achievable -
- Code: Select all
<cms:show_repeatable 'banners'>
<cms:if k_count="1" >
<cms:set random_number="<cms:php>echo rand(1, <cms:show k_total_records />);</cms:php>" 'global' />
</cms:if>
<cms:if k_count="<cms:show random_number />" >
<cms:show banner/>
</cms:if>
</cms:show_repeatable>
But if you have to show a few elements at random then it's more complicated - the code gets big and heavy.
It would be really great if the repeatable region maintains order='random'.
I also ask KK to try to find a systemic solution.
Thanks