I have a specific objective that I’m trying to accomplish and I have been unsuccessful thus far.
The premise of this is to display a list of events using Ditto. I am including pagination into this, breaking the events down to multiple pages. However the twist is that I’ve setup the Ditto with some tricky filters, one is to include ONLY events that are NOT in the past. All of this works great, except when all of the events have past. I am then left with the message "No documents found", as well as pagination styling when there are no additional pages. I realize that I can easily change the message using the "&noResults" parameter, but that does not address that the pagination styling remains.
What I attempted to do was use PHx with an If/Else statement to display or NOT display the pagination. I found that this did not go as planned. Infact, I discovered that when I installed PHx and while it was enabled, my standard pagination broke before I even tried to use a PHx statement on my ditto page. I don’t know why that is, or what that is indicating.
For reference, here is the Ditto call that I’m using to pull up the list of events:
[!Ditto? &parents=`1097` &orderBy=`eventstartdate ASC` &display=`6` &paginate=`1` &paginateAlwaysShowLinks=`1` &tpl=`tpl_eventlisting` &filter=`event_country,United Kingdom|eventenddate,@EVAL return strtotime(now);,6`!]
As you can see I’m using an @EVAL binding to filter out the events that have already passed.
The PHx statement that I was attempting to use is:
[+phx:if=`[+total+]`:is!=`0`:then=`{{pagination}}`:else=``+]
With pagination working "[+total+]" is equal to the total number of documents being display. In this example, it would be zero. My thought here is to check that number and display the pagination code (via a chunk) when the condition is met. Else, display nothing.
Also for reference, my pagination chunk:
<div class="ditto_paging">
<div id="ditto_counts">Displaing page <strong>[+currentPage+]</strong> of <strong>[+totalPages+]</strong></div>
<div id="ditto_pages">[+previous+] [+pages+] [+next+]</div>
</div>
A problem, as I mentioned earlier. When PHx is enabled in the manager, it breaks the pagination before I even attempt to incorporate the PHx statement I provided above.
I am not sure where to go from here. Help on this would be wonderful. Thank you.