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

    It seems I can use &offset with a simple getResources call but not with either the Articles paging "Other Listing Parameters" option and also with getPage.

    For example this DOES work:

    
    [[!getResources?
       &parents=`ID`
       &limit=`6`
       &includeTVs=`1`
       &includeContent=`1`
       &offset=`5`
       &tpl=`TPL`
       &sortby=`{"publishedon":"DESC"}`
       &processTVs=`1`
       &showHidden=`1`
    ]]
    
    


    But this DOESN'T (offset is completely ignored):

    [[!getPage?
       &element=`getResources`
       &parents=`ID`
       &limit=`6`
       &pageVarKey=`page`
       &includeTVs=`1`
       &includeContent=`1`
       &offset=`5`
       &tpl=`TPL`
       &sortby=`{"publishedon":"DESC"}`
       &processTVs=`1`
       &showHidden=`1`
    ]]
    
    <div class="paging">
    <ul class="pageList">
      [[!+page.nav]]
    </ul>
    </div>
    
    


    Adding &offset=`5` to the 'Other Listing Parameters' fails as above, things are output but the offset is ignored.

    Any ideas anyone?

    Much appreciated.
      • 34109
      • 119 Posts
      Doesn't getPage send its own offset value through to getResources? That could by why your value is being ignored.
        Studio Republic
        http://www.studiorepublic.com
        0845 226 3205
        @christodhunter
        • 38723
        • 165 Posts
        I thought that getPage took all the same parameters as getResources?

        Seems to be listed on the RTFM page: http://rtfm.modx.com/display/ADDON/getPage

        I guess articles is having issues the same way then since I'm guessing that uses getPage as well?
          • 37242 ☆ A M B ☆
          • 339 Posts
          Limit 6 and offset 5?

          Try separating &soryby and &sortorder
            • 38723
            • 165 Posts
            Thanks for the suggestion, still no luck.

            Yep, I want 6 items per page, but have a page before these calls that layout in a different way the "main" news story, followed by four other recent items in a different layout.

            This page needs to show from item 6 onwards (ie - none that appear in the five on the page before) and show 6 per page in this archive.

            I guess the &offset should actually be 6 not 5, but that still makes no difference to the output!

              • 37242 ☆ A M B ☆
              • 339 Posts
              I'll check my currrent GetPage code...
                • 37242 ☆ A M B ☆
                • 339 Posts
                By the way: did you write plain "ID" or [[~[[*id]]]] ?
                  • 38723
                  • 165 Posts
                  I just typed &parents=`95`

                  using
                  [[ ~95 ]]
                  doesn't work for me.

                  [ed. note: pdincubus last edited this post 14 years, 2 months ago.]
                    • 37242 ☆ A M B ☆
                    • 339 Posts
                    That is what im ment - my quote here was truncated by the forum.

                    Are the pagination elements showing up (at least in the source code)?

                    What exactly is the output? Du you even have enough Resources to output 6 further elements?
                      • 38723
                      • 165 Posts
                      There are 7 elements just to be sure. I've tried with limit=`2` for example to make sure i'm not being stupid!

                      The pagination works fine - the only thing that isn't working is that it's ignoring the fact that I don't want to see the first five items in that bunch of results.