I’m currently building a Ditto list within a popular website and need to ensure the my Ditto addition always shows two even columns. To achieve this effect I would like to use PHx to display a graphic banner should the first column be longer than the second thus making both column equal in length.
As such I could use the [+total+] pagination placeholder value and then use this value in a PHx script to detect if the pagination number is odd and then display a banner if needed. Unfortunately as there is a pre-existing issue with Ditto pagination not working on cached pages with PHx present I can only perform this script on non-cached pages. As the site is very busy caching is essental, so this leads me to question whether there are any other ways detect whether a is list even or odd?
Thanks for any help
Thanks for feedback sharkbait,
How would it be possible to enable the Pagination [+total+] placeholder within a cached page with PHx present?
It’s not clear how the linked snippet would help us with this issue as it only splits the Pagination which we don’t need. If there is an alternative placeholder we can use to show the quantity of listed items within a Ditto call this would help. Additionally we have more than 1 Ditto per page.
I already have the iteration working, however how do I pass the iteration value to either the page template to action a PHx script [+phx:if=``:then=``+] or have the Ditto include an extra banner item if the list is uneven?
Example Ditto call
Odd number of pages:
<ul>
<li class="even">page</li><li class="odd">page</li>
<li class="even">page</li><li class="odd">page</li>
<li class="even">page</li><li class="odd">show banner to make even</li>
</ul>
When even number of pages:
<ul>
<li class="even">page</li><li class="odd">page</li>
<li class="even">page</li><li class="odd">page</li>
<li class="even">page</li><li class="odd">page</li>
</ul>
PS. I’ll also PM you the site link.
Thanks Jan, it worked like a charm, perfect