I have an issue with a solution I implemented to output entries in groups of four, using the switch parameter. Perhaps it’s not the best solution, so any advice on an alternate method to achieve the same result is most welcome.
I have used the switch parameter to wrap every four entries with an opening and closing <li> tag, but there is one flaw in this approach.
I have the following in the template:
<ul class="slideshow listing plain">
{exp:channel:entries channel="channel_portfolio" disable="member_data"}
{switch="<li class='slide'>|||"}
<div class='item {switch="column1|column2"}'>{title}</div>
{switch="|||</li>"}
{/exp:channel:entries}
</ul><!-- end slideshow -->
This works great, except for when the total entries is not divisible by four. If there isn’t a fourth entry in each group, the <li> tag does not close.
I can’t figure out how to ensure that there is always a closing </li> tag on the final group… Any ideas?
Thanks so much!
-m