With pagination turned on, especially on new projects, there might be less documents to show than we has specified in &summarize, but we still get the pagination previous/page/next strings displayed.
To prevent this from happening, I was adding this code after line 1136 in ditto.class.php (2.1b3), at the end of the function paginate():
if ($total == $summarize ) {
$modx->setPlaceholder($dittoID."next", "");
$modx->setPlaceholder($dittoID."previous", "");
$modx->setPlaceholder($dittoID."pages", "");
}
This is simply resetting the values for the placeholders to an empty string. Compared to just return false, this method still works when we want to make use of the placeholders for [+start+], [+stop+], [+total+] etc, which are embedded in html code:
<p>Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles | Page <strong>[+currentPage+]</strong> of <strong>[+totalPages+]</strong> </p>
<div id="ditto_pages"> [+previous+] [+pages+] [+next+] </div>
It’s showing something like this at the bottom of the page then, but that’s not bothering me:
Showing
1 -
3 of
3 Articles | Page
1 of
1
Do you think this is a robust solution, or are we possibly running into trouble in some cases with that modification?