With 6 items uploaded to the Collections container the following is rendered…
item 2
item 2
item 5
item 6
So 1 item in the first 3 columns and 3 in the 4th column with ‘item 2’ displaying in cols 2, 3 & 4!
Confused!
Can anyone point me in the right direction?
Thanks
J
I believe you have to call getResources four times to get the result you want.
In each call to getResources set one of the templates (&tpl, &tpl_2, …) to saleImageTpl and the rest of them to an empty chunk.
Or, if you have some experience with programming in PHP, it’s probably easier/cleaner to write a custom snippet (or duplicate getResources and make some adjustments).
Except I want Item 1 to display in the first column, Item 2 in the second, Item 3 in the third, Item 4 in the fourth and then back to column1 for Item 5, column 2 for Item 6 etc.
Does that make sense?
Thanks
Are the number of items alway’s 12?
If so, then you could do this without programming:
Use this option in getResources: toSeparatePlaceholders
This wil create a placeholder for each item, then use those placeholders in your template, that way you can put the first in the first column the 2nd in the 2nd, etc etc.
I think you’re making this more complicated than it needs to be. You don’t need getResources to do anything for you other than list the items each in its own div. Then use CSS to create whatever columns you need. Here’s a Codepen showing how to do this using either Flexbox or Grid. (I suggest aiming for a responsive layout as 4 columns is unlikely to work well on mobile.)
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.