If you aren't in a hurry lea, you better wait for @matt's plugin. You can do lots of things with twig, but it's a template language and such thing like my code below are actually considered bad practice!
–
carlcsJul 14 '14 at 23:29

1 Answer
1

This is based on Matt's answer to your previous question. Likewise this should better be used within cache tags!

This is untested, but it hopefully works out for you.

.

Edit:

This is still untested but it came to my ears, that it could make problems to assign variables as array keys. That's why I changed the code to use objects instead. If anyone uses this code, I'd be happy to hear if it does actually work!