We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8779
    • 93 Posts
    How to use Paginate in modX
    I getting frustated on this progress.

    This is my ditto call
    [!Ditto? &startID=`1` &summarize=`2` &paginate=`1`  &paginateAlwaysShowLinks=`1` &tagDelimiter=`,` &tagData=`tvcategoryMain` &tagMode=`onlyTags` &tags=`News` &hiddenFields=`featuredimage`  &tpl=`thumbnailTpl`!]
    
    [+previous+] [+pages+] [+next+]


    But this is not working.
    The previous, pages and next placeholders didn’t showed.

    Help me please. Thank you
    I have follow the instruction in the forum >> http://modxcms.com/forums/index.php/topic,12262.45.html
    But it didn’t work.
      • 36416
      • 589 Posts
      Quote from: elven_ranger at Jun 17, 2009, 10:14 PM

      The previous, pages and next placeholders didn’t showed.

      PHx conflicts with Ditto pagination placeholders.
      Use cached Ditto call on uncached page, disable PHx plugin, or:
      http://modxcms.com/forums/index.php/topic,34522.msg210035.html#msg210035
        • 8779
        • 93 Posts
        Use cached Ditto call on uncached page, disable PHx plugin, or:

        What does this mean?
        I don’t understand how to do it.

        And with the url you give, I don’t understand too, where that code I must put into, and how to call it.
        I’ve create in a snippet named DittoPageSplit, I’ve tried to call it, but nothing is working.

        thanks
          • 8779
          • 93 Posts
          THANKSSS!!!! Thanks a Lot EOL
          MARVELOUSS!!!

          It works Dude!!!
          Thanks youuuuuuuuuuu very much!!!!
            • 8779
            • 93 Posts
            EOL, now I want to change the paramater of this code
             function generatePagination($curPage, $totResults, $resultsPerPage) {
            	  $totPages = ceil($totResults / $resultsPerPage);
            	  $pagesBefore = $curPage - 1;
            	  $pagesAfter = $totPages - $curPage;
            	  $tabArr = array();
            	  if ($totPages > 15) {
            	    if ($pagesBefore > 7) {
            	      $tabArr = array(1, 2, 0);
            	      if ($pagesAfter > 7) {
            	        for ($i=($curPage-4); $i<$curPage; $i++) { $tabArr[] = $i; }
            	      } else {
            	        for ($i=($totPages-11); $i<$curPage; $i++) { $tabArr[] = $i; }
            	      }
            	    } else {
            	      for ($i=1; $i<$curPage; $i++) { $tabArr[] = $i; }
            	    }
            	    $tabArr[] = $curPage;
            	    if ($pagesAfter > 7) {
            	      if ($pagesBefore > 7) {
            	        for ($i=($curPage+1); $i<=$curPage+4; $i++) { $tabArr[] = $i; }
            	      } else {
            	        for ($i=($curPage+1); $i<13; $i++) { $tabArr[] = $i; }
            	      }
            	      $tabArr[] = 0;
            	      $tabArr[] = $totPages-1;
            	      $tabArr[] = $totPages;
            	    } else {
            	      for ($i=($curPage+1); $i<=$totPages; $i++) { $tabArr[] = $i; }
            	    }
            	  } else {
            	    for ($i=1; $i<=$totPages; $i++) { $tabArr[] = $i; }
            	  }
            	  return $tabArr;
            	 }//function generatePagination end


            But I didn’t get your logic to genereate this.
            I want just simple page to appear like

            <Prev 123...10 11 Next>

            I want to set if the total page is bigger than 7, then the (...) is appear.
            How to setting it?
            I change the value, but I get confused.
            hoho, thank you
              • 36416
              • 589 Posts
              Quote from: elven_ranger at Jun 18, 2009, 03:31 AM

              I want to set if the total page is bigger than 7, then the (...) is appear.
              How to setting it?

              I didn’t wrote that code, just adapted it for Ditto 2.1 from SplitPagination snippet and Metaller (?) modifications.
              You could try changing hardcoded total pages value from 15 to 7, special cases at the start/end of interval from 7 to 4,
              etc... or rewrite it from scratch following this tutorial:
              http://www.javascriptworkshop.com/2007/11/05/php-pagination/
                • 8779
                • 93 Posts
                I’ve did that before
                And the paginate is broken. lol.
                  • 36416
                  • 589 Posts
                  Quote from: elven_ranger at Jun 19, 2009, 12:03 AM

                  I’ve did that before
                  And the paginate is broken. lol.

                  Oh well, maybe I’ll try to parametrize page hiding threshold sometimes later this month...