I know this has been addressed before, but I need a little help.
Here’s what I’m trying to do using a channel:entries tag:
<ul>
<li>Entry 1</li>
<li>Entry 2</li>
<li>Entry 3</li>
<li>Entry 4</li>
</ul>
<ul>
<li>Entry 5</li>
<li>Entry 6</li>
<li>Entry 7</li>
<li>Entry 8</li>
</ul>For every group of 4 entries, I need to wrap them in a <ul> tag, for an unlimited/unknown total entries.
I’ve tried this:
{exp:channel:entries channel="test"}
{switch="<ul>|||"}
<li>{title}</li>
{switch="|||</ul>"}
{/exp:channel:entries}This method seems the best, and is very close to working; however, if the total number of results isn’t divisible by 4(ie, the last group only has 3 items in it), the last </ul> tag is never output, which causes the code to break.
If I add the last tag using {if count = total_results}, that still doesn’t work because in instances where the total count is divisible by 4, I get double </ul> tags.
I was really trying to get this to work natively, so please tell me if there is a way, or if I just need to use PHP instead.
Thanks!