We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21496
    • 225 Posts
    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?
      René
      • 18397
      • 3,250 Posts
      Could you please file a ticket for this and reference the following similar ticket:
      http://mirror3.cvsdude.com/trac/ditto/codebase/ticket/79
        • 7231
        • 4,205 Posts
        Sorry to bring up an old topic, but has this been integrated into Ditto 2.1? Did not spot it in the changelog or the docs. I would like to hide the pagination if only one page is available.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don&#39;t know what it is.
          Do you, Mr. Jones? - [bob dylan]