2

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?

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

.row-two
- col {entry 1 data}
.row-two
- col {entry 2 data}
.row-two
- col {entry 3 data}

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

.row-two
- col {entry 4 data}
.row-two
- col {entry 5 data}
.row-two
- col {entry 6 data}

-etc-

1 Answer 1

3

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

Setting the list:
https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset_list%7D#capturing-channel-entry-data

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

2
  • 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, 2013 at 17:11
  • So I ended up just setting the offsets without fractions and everything works great. Thanks again!
    – g-nice
    Dec 26, 2013 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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