We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36834
    • 25 Posts
    I understand how ’offset’ works in getPage - what I am saying is that the ’offset’ property of getPage is conflicting with the ’offset’ property of getResources (both do different things) - if I comment out the aforementioned property in the getPage snippet, then the result set returned by getResources honours any offset value passed to it. If not then we end up with the issue described in replies below where ’offset’ is not honoured.

    I would expect getResources to operate with getPages exactly as it does if used independently, would you not?
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: simonp98 at Oct 10, 2010, 04:14 AM

      I understand how ’offset’ works in getPage - what I am saying is that the ’offset’ property of getPage is conflicting with the ’offset’ property of getResources (both do different things) - if I comment out the aforementioned property in the getPage snippet, then the result set returned by getResources honours any offset value passed to it. If not then we end up with the issue described in replies below where ’offset’ is not honoured.

      I would expect getResources to operate with getPages exactly as it does if used independently, would you not?
      No I would not; I think your logic is flawed. If you want to automatically determine offset based on paging, that’s one thing. What you are doing is trying to use an arbitrary limit you use for one call as criteria for being excluded in the next call; IOW, regardless of paging, the second set of records needs to consider the first set of records minus the original call’s records. This is not a conflict of the offset properties; it’s how getPage and getResources (or getPage and any snippet that supports it’s paging technique) work together to accomplish paging.

      You either need a custom solution or to find a way to exclude the original call’s records in the second call that is being paged over.
        • 36834
        • 25 Posts
        Thanks for your reply and sorry if I’m being stupid but maybe I don’t understand the term ’Offset’. I’m not trying to be clever of difficult, but want to understand exactly where I’m going wrong.

        I was under the impression that Offset in getResources was having the same effect as ’LIMIT offset, a large number’ on the set of results being returned. So I thought that my call to getResources was returning a full set of News Resources from the 6th Resource onwards. I thought these were then being passed to getPage for paging.

        I also thought that when using getPage with getResources that the properties specified in the call were those of getResources (’includeTVs’, ’processTVs’ etc). But if getResources and getPage have properties of the same name (offset and limit), how can this work?

        Thanks for your patience.
          • 22303 MODX Staff
          • 10,725 Posts
          What could work is having a feature in getPage which would artificially increment the page-driven offsets by a set amount. This would accomplish what you want. It would simply add the specified integer value to the offset that is calculated and sent to the getResources call.
            • 28554
            • 201 Posts
            The documentation in rtfm.modx.com doesn’t contain anything, is there documentation available somewhere else?

            Thanks!
              • 22303 MODX Staff
              • 10,725 Posts
              I have finally provided some basic documentation at http://rtfm.modx.com/display/ADDON/getPage -- feedback appreciated.
                • 28554
                • 201 Posts
                @OpenGeek: thanks! Is there a debug-option available? My call isn’t outputting anything and I’m not quite sure why...
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: StevenLangbroek at Oct 17, 2010, 05:57 AM

                  @OpenGeek: thanks! Is there a debug-option available? My call isn’t outputting anything and I’m not quite sure why...
                  Does your getResources (or whatever Snippet you are calling) work as expected before wrapping it with getPage? There is currently no debug option because getPage doesn’t do much itself, but rather helps set the limit and offset values for the Snippet being called.
                    • 28554
                    • 201 Posts
                    Quote from: OpenGeek at Oct 18, 2010, 09:05 AM

                    Quote from: StevenLangbroek at Oct 17, 2010, 05:57 AM

                    @OpenGeek: thanks! Is there a debug-option available? My call isn’t outputting anything and I’m not quite sure why...
                    Does your getResources (or whatever Snippet you are calling) work as expected before wrapping it with getPage? There is currently no debug option because getPage doesn’t do much itself, but rather helps set the limit and offset values for the Snippet being called.

                    Just found what was wrong: had to pass showHidden to getResources. My bad! Thanks for the help!
                      • 19534
                      • 183 Posts
                      Hi!

                      I’m wondering if only getResource supports the usage of getPage. I’d like to use getPage for the following (standard) snippets, too:

                      But they both seem to provide there own pagination system which is not that powerfully like getPage. Do you know if getPage can be used for these snippets, too?
                        Add-On to easily manage your multilingual sites: Babel