We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18367
    • 834 Posts
    What I want to do is get getResources to display the second or third document but not the first of a parent.

    I can't specify the doc id 'cos the docs change regularly.

    It's basically a sort of latest news, you may also like setup, but I am specifying where each doc appears.

    See here for example http://makethemclick.com.au/library/conversion-rates/box-test

    This example uses different parents and works to a point.

    However, as I said, I know want to set the document level from which it starts.

    Any ideas anyone?

    Thanks





    [ed. note: markg last edited this post 11 years ago.]
      Content Creator and Copywriter
    • Could you hide from menus the resources you don't want to display? Then, when and if you did want them to display, just use &ignoreHidden with the Wayfinder call.
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 22427
        • 793 Posts
        You could use getResources instead of Wayfinder. It has a lot of flexibility to control the output using properties.
        There is a property "offset" which allows to skip several documents before the ones you want to be displayed.
        http://rtfm.modx.com/display/ADDON/getResources
          • 18367
          • 834 Posts
          Quote from: ottogal at Apr 10, 2013, 09:15 AM
          You could use getResources instead of Wayfinder. It has a lot of flexibility to control the output using properties.
          There is a property "offset" which allows to skip several documents before the ones you want to be displayed.
          http://rtfm.modx.com/display/ADDON/getResources

          What am I talking about? Why did I say Wayfinder?

          I am using get resources, sorry my mistake.

          The code I have so far is
          [[!getResourcesTag? &elementClass=`modSnippet` &element=`getResources` &tpl=`largebox` &parents=`9` &depth=`1` &limit=`1`  &includeContent=`1` &includeTVs=`1` and &processTVs=`1` ]]


          I'll investigate the offset function.

          Thanks ottogal.

            Content Creator and Copywriter
            • 18367
            • 834 Posts
            Hmmm,

            not sure if I understand how the offset function is supposed to be implemented.

            I tried this with no result.

            	[[!getResourcesTag? &elementClass=`modSnippet` &element=`getResources` &tpl=`largebox` &parents=`9` &depth=`1` &limit=`3` &offset=`3` &includeContent=`1` &includeTVs=`1` and &processTVs=`1` ]]


            Any ideas?
              Content Creator and Copywriter
              • 18367
              • 834 Posts
              Anyone?
                Content Creator and Copywriter
              • Offset works on the returned set. If you have limit=`3` and offset=`3`, you're only returning three items, if it skips the first three I would expect you to get nothing displayed.

                Hmmm... looking at the code, that's all wrong. It should be fetching the fourth, fifth and sixth item from the database, according to this...
                if (!empty($limit)) $criteria->limit($limit, $offset);
                
                if (!empty($debug)) {
                    $criteria->prepare();
                    $modx->log(modX::LOG_LEVEL_ERROR, $criteria->toSQL());
                }
                $collection = $modx->getCollection('modResource', $criteria, $dbCacheFlag);
                
                
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 18367
                  • 834 Posts
                  Doesn't matter what number I put in the offset, it makes no difference.

                  I've tried different numbers in both the offset and limit, and other than increasing the number or items displayed, it has no effect. It's almost as if offset isn't working or being read.

                  I was under the impression all I had to do was add offset to the getResources call. IS there another step required to make it work?
                    Content Creator and Copywriter
                    • 22840
                    • 1,572 Posts

                    [[!getResourcesTag? &elementClass=`modSnippet` &element=`getResources` &tpl=`largebox` &parents=`9` &depth=`1` &limit=`3` &offset=`3` &includeContent=`1` &includeTVs=`1` and &processTVs=`1` ]]

                    Why do you have the word "and" in your call ?

                    Try taking that out and see if theres any differance.
                      • 18367
                      • 834 Posts
                      OK,

                      removing the "and" doesn't make any difference.

                      Here's the call as it is:

                      	[[!getResourcesTag? &elementClass=`modSnippet` &element=`getResources` &tpl=`largebox` &parents=`3` &depth=`1` &limit=`1` &offset=`3` &includeContent=`1` &includeTVs=`1` &processTVs=`1` ]]


                      It just shows the 1st item.


                        Content Creator and Copywriter