toneymutinda's avatar

Chunking results

Hey guys, Am developing a posts application..and in my blog view(where all posts will be displayed), i need to group the results in groups of three, whereby each group will be displayed as a row in my view. So i will end up having rows of three posts each displayed as columns. Mind you, i don't mean pagination.

0 likes
1 reply
Snapey's avatar

the solution is really tied to the way you want to generate your html

you could use chunk() on the collection, or you could use the $loop variable within the foreach so that you output different html every third post

Alternatively use css flexbox to list all the posts and have the browser decide if there should be 1,2,3 or more posts across the available width

Please or to participate in this conversation.