We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29703
    • 217 Posts
    Hi all,

    I’m pretty sure I’m being really really dense as I’ve done this many times before but can’t seem to get it to work with the new modx.

    I want to limit the pagination results to 7

    i.e.

    <-Previous [1][2][3][4][5][6][7] Next->

    I’m confused as to what parameter limits the pagination. I’ve tried &display=`7` but that just changes the amount of entries ditto displays.

    My call is as follows (&display=`1` is so there’s over 7 pages listed):

    [!Ditto? &parents=`3` &orderBy=`createdon DESC` &tpl=`BlogListing` &paginate=`1` &display=`1` &paginateAlwaysShowLinks=`0`!]


    <div id="paginate">
    [+previous+][+pages+][+next+]
    </div>


    So where do I specify the pagination limit? Any help would be heartily appreciated! smiley

      • 4310
      • 2,310 Posts
      If you wanted 4 results per page and 7 pages paginated then I think you would do :
      &display=`4` &total=`28`

      for 4 results per page and 4 paginated pages it would be :
      &display=`4` &total=`16`

      and so on.
        • 29703
        • 217 Posts
        Hey thanks for the reply.

        I can get this, but what if I have an ever expanding amount of entries? I’m trying to use this pagination system for a blog so recalculating the &total manually seems rather ineffective.

        I’ve also tried using the splitPagination snippet but that doesn’t work either.


        When I use &total=`7` it limits my blog entries to 7. Really I just want to limit the pagination to 7.

        Edit ->

        Okay SplitPagination is supposed to do what I’m looking for, but it doesn’t limit the entries and add a ’...’ in between.

        I want this:

        <-Previous [1][2][3][4]...[11][12] Next->

        I’m getting this:

        <-Previous [1][2][3][4][5][6][7][8][9][10][11][12] Next->

        But SplitPagination doesn’t seem to have any parameters so I’m not sure how this would work. huh
          • 4310
          • 2,310 Posts
          Isn’t that what
          &display=`4`
          does?
          Limit the results to 4 per paginated page, as many pages as needed.
            • 29703
            • 217 Posts
            Yeah I tried that before and it didn’t make a difference.

            Bizarrely I’m trying it now and I’m getting a resource array error. One per instance of pagination.

            I remove the &display=`2` and the resource error vanishes.


            Okay ignore that - that’s my fault for using both ’summarize’ and ’display’ to try resolve the problem.


            It seems &display limits the number of entries displayed on the page. That works fine. It’s the pagination numbers that I need to limit, as I have (or will have) hundreds of ditto entries.

            Basically &display doesnt affect the pagination - what does?

            <-Previous [1][2][3][4]...[11][12] Next-> - is what I’m after

            Thanks for the help btw smiley