With Stash, is it possible to store pieces of EE channel entry data and insert it based on a count or some other logic?

I have a three column bootstrap grid below that splits an entry's data into two parts in the template.

Can I store and get the data based on a count or some other logic using Stash and Switch?

- col {entry 1}
- col {entry 2}
- col {entry 3}

- col {entry 1 data}
- col {entry 2 data}
- col {entry 3 data}

- col {entry 4}
- col {entry 5}
- col {entry 6}

- col {entry 4 data}
- col {entry 5 data}
- col {entry 6 data}


You can capture the entries as a Stash list and use fractions to split into parts:

Setting the list:

Getting the list and using fractions: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aget_list%7D#using-fractions-to-split-lists

  • That's brilliant. Thanks! I have it set up pretty much exactly how I need it, just struggling with exact fractions/offsets. I'm outputting 16 entries and grouping them in 3s, which works until the 5th loop: Code: pastebin.com/XRe6WT8b It's a bit messy, but I'm planning on saving the get list markup as stash variables so that I'm not repeating those code blocks. – g-nice Dec 26 '13 at 17:11
  • So I ended up just setting the offsets without fractions and everything works great. Thanks again! – g-nice Dec 26 '13 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.