We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42503
    • 120 Posts
    Hi,
    In one of my present requirement I need to list all the resources under a parent, but the exception is, it will not show the current resources in the listing. I mean if user click on resource 1, its load and rest of the resources will list down like 2, 3, 4, 5. The logic will remain same for other.

    I have used this code but it is not giving me correct result
    [[!getResources?
    &parents=`[[*id]]`
    &limit=`4`
    &resources=`-[[*id]]`
    &includeTVs=`1`
    &processTVs=`1`
    &tpl=`some_tpl`
    ]]

    Need help to fix this.


    Thank you

    Pronab

    This question has been answered by sottwell. See the first response.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I think you could use something like
      [[!getResources?
      &parents=`[[*parent]]`
      &limit=`4`
      &resources=`-[[*id]]`
      &includeTVs=`1`
      &processTVs=`1`
      &tpl=`some_tpl`
      ]]
      
        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
        • 42503
        • 120 Posts
        Thanks for your reply, but it is not working. Can you please suggest some other way.

        Quote from: sottwell at May 25, 2015, 04:07 AM
        I think you could use something like
        [[!getResources?
        &parents=`[[*parent]]`
        &limit=`4`
        &resources=`-[[*id]]`
        &includeTVs=`1`
        &processTVs=`1`
        &tpl=`some_tpl`
        ]]
        
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Let me make sure that I understand You have a Resource Tree structure like this:
          parent
            -- Page 1
            -- Page 2
            -- Page 3
            -- Page 4
            -- Page 5


          You want each page to list its siblings, but not itself?
            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
            • 42503
            • 120 Posts
            Yes, you are correct.
            Quote from: sottwell at May 25, 2015, 11:33 AM
            Let me make sure that I understand You have a Resource Tree structure like this:
            parent
              -- Page 1
              -- Page 2
              -- Page 3
              -- Page 4
              -- Page 5


            You want each page to list its siblings, but not itself?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              [[!getResources? &parents=`[[*parent]]` &resources=`-[[*id]]` &tpl=`myTpl` &sortby=`menuindex`]]


              Works for me.
                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
              • discuss.answer
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Ok, fixed that up a little...
                [[!getResources? 
                  &parents=`[[*parent]]` 
                  &resources=`-[[*id]]` 
                  &limit=`3`
                  &tpl=`parentTpl` 
                  &sortby=`menuindex`
                  &sortdir=`ASC`
                ]]
                  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
                  • 42503
                  • 120 Posts
                  Thanks a lot, it works. Thank you again.

                  Quote from: sottwell at May 25, 2015, 11:59 AM
                  Ok, fixed that up a little...
                  [[!getResources? 
                    &parents=`[[*parent]]` 
                    &resources=`-[[*id]]` 
                    &limit=`3`
                    &tpl=`parentTpl` 
                    &sortby=`menuindex`
                    &sortdir=`ASC`
                  ]]