Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to count occurrences of a fragment in a page? (collection display)
Hi all,
I'm using the new features from 7.4 (fragments, collection display, etc.) instead of asset publisher with widget and structure templates. Just because. :-)
I've defined a collection of webcontents and added a collection display on my content page. I also defined a fragment to be used on the collection display and it's working (almost) fine.
The problem is that our design requires us to alternate left/right aligment on even/odd items from the collection. Not a problem with widget templates, but I don't see a way of doing this with the collection display, which is not templeatable. Or is it?
I thougth I could put a counter on some attribute on the request or session, but these objects seem not to be available inside the fragment freemarker.
Any ideas?
TIA
Fernando