We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36924 ☆ A M B ☆
    • 298 Posts
    getResources has not been working for me in the 8 months. At some point I had to move back to Drupal on a project just because of this.

    I have seen many post on this forum with fellows literary crying out as a result of getResources not outputting the anything.

    Whatever you do, even when you have the debug property set to true, you get a blank display. You check that it is install, and find it is. You do a fresh install (and maybe two/three fresh install no joy. You copy getResources ZIP from a old website where it is successfully in used (maybe way back 2012 or 2011) and plug it in: still no joy. As if to cap it all, you also get no error log!

    Recently I have had to fall back on getRelated (which doesn't behave exact for the purposes intended).

    Here and now, I hope we can clear what went wrong with the second most important snippet after Wayfinder.

    Thank you. [ed. note: ojchris last edited this post 13 years, 1 month ago.]
      • 37210
      • 131 Posts
      Quote from: ojchris at Sep 04, 2013, 09:33 PM
      getResources has not been working for me in the 8 months. At some point I had to move back to Drupal on a project just because of this.

      Hi Chris,

      No, I certainly wouldn't say that GetResources is dead. I use it all the time for multiple websites and I've never had trouble with it.

      Can you post some more info on your website? Here's the suggested post template, then maybe somebody could give you a hand:

      Description of Problem:

      Steps to Reproduce:

      Expected Outcome:


      • MODX Version:
      • PHP Version:
      • Database (MySQL, SQL Server, etc) Version:
      • Additional Server Info:
      • Installed MODX Add-ons:
      • Error Log Contents: (attach as file if it’s too large)


      Sar
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Likewise. I've never had a problem with it, except for stupid typos and the occasional failure of logic when using MODx tags for the parents property. Especially using placeholders for that can cause baffling failures, in cases where MODx is trying to process the placeholder before the snippet itself has been run to create the placeholder.

        Lately I've been using pdoResources (installs with pdoTools) instead; not much documentation on it yet, but it's a quite interesting application of the pdoTools library, and reportedly much faster than getResources. So far it's served as a drop-in replacement for getResources in every situation where I've used it.
          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
          • 36924 ☆ A M B ☆
          • 298 Posts
          A recent intence:

          [[!getResources? &resources=`41`&tpl=`PDFlinktpl`&includeTVs=`1`&includeContent=`1`]]

          Resource 41 is a container resource with a couple of static resources as child.
          PDFlinktpl is a chunk template that links to the static resources. The getResource call is placed in the content area of resource 41.

          I got no output.

          @sottwell: Is there a tiny tutorial on pdoResources? Do you have time to create one 'for the rest of us'?
            • 10487 MODX Staff
            • 1,535 Posts
            Hi ojchris, can you please post the errors you're getting (from your PHP error log) when you get a blank page. It would help to know what they are before diagnosing the problem further.

            This snippet is probably one of the most downloaded for MODX Revolution and it's been used by many people without issue - it sounds to me like there are problems somewhere with your MODX setup but I'll need to know a bit more detail to know for sure.
              Garry Nutting
              Senior Developer
              MODX, LLC

              Email: [email protected]
              Twitter: @garryn
              Web: modx.com
              • 3749
              • 24,544 Posts
              If you've put that getResources tag in the content of Resource 41, you've got an infinite loop. Every time getResources gets that resource, it's going to execute again and get the resource again, ad infinitum.

              Are you sure you don't mean to have &parents=`41` instead of &resources=`41`?
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 37210
                • 131 Posts
                Quote from: ojchris at Sep 05, 2013, 02:30 AM
                A recent intence:

                [[!getResources? &resources=`41`&tpl=`PDFlinktpl`&includeTVs=`1`&includeContent=`1`]]

                First off..change &resources to &parents. Otherwise, you're only going to return one page...which is 41. What you want is a list of pages that are UNDERNEATH 41 right?

                Sar
                  • 37210
                  • 131 Posts
                  Quote from: BobRay at Sep 05, 2013, 03:31 AM
                  If you've put that getResources tag in the content of Resource 41, you've got an infinite loop. Every time getResources gets that resource, it's going to execute again and get the resource again, ad infinitum.

                  Are you sure you don't mean to have &parents=`41` instead of &resources=`41`?

                  Ah dammit..you beat me to it.
                    • 10487 MODX Staff
                    • 1,535 Posts
                    Good catch Bob smiley
                      Garry Nutting
                      Senior Developer
                      MODX, LLC

                      Email: [email protected]
                      Twitter: @garryn
                      Web: modx.com
                      • 36924 ☆ A M B ☆
                      • 298 Posts
                      Ok. I can confirm changing %resources to &parent worked.

                      Now getResources is alive I'm trying to achieve this: I want the children (actually links to them) of the resource A to be printed on resource A.

                      The children are static resources. So I have my getreource call placed in the current
                      [[!getResources? &parents=`[[+ids]]`&tpl=`PDFlinktpl`&includeTVs=`1`&includeContent=`1`]] 


                      The output of PDFlinktpl is a link linking to the specific child resource. Here is PDFlinktpl:

                      <tr class="row">
                      <td width="9%">1.</td>
                      <td width="64%"><p>[[+introtext]]</p></td>
                      <td width="27%"><p><a href="[[~[[+id]]]]">Download</a> (<img src="/assets/mytemplates/sitefolder/asset/images/pdficon_small.gif" height="17" width="17" class="icon" alt="pdf icon" /> 
                        PDF, [[+tv.docpages]] pages - [[filesize?&file=`[[+content]]`]])</p></td>
                      </tr>


                      The intention is for the user to be able to view resource A and see a list of links (linking to the various child resources under resource A). But right now testing with a single resource, I find that any link to resource A behaves as if linking to the child static resource. So stead of displaying resource A, the static resource is being downloaded.

                      I'm struggling to paint the scenario, I hope you get what I intend and what I'm getting?