We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21606
    • 46 Posts
    I have several sites on MODx (different versions as well), but so far have not used getResources for anything. I’ve tried to use it and am not getting any results??? I’m positive it’s my problem. How can I check to be sure it’s working and can someone ask some questions or or suggest some action I can take to make it work?
      • 22840
      • 1,572 Posts
      can someone ask some questions or or suggest some action I can take to make it work?
      A example of how your using it would help us smiley
        • 8609
        • 607 Posts
        As paulp states, an example of your call and what the end result is would be helpful. Also take a look at http://codingpad.maryspad.com/2011/04/11/modx-revolution-for-complete-beginners-part-10-using-getresources-to-aggregate-content/ where I go over different things to note about using getResources. For example, you need to ensure you include a tpl in your call, if your resources are hidden from the menu you need to add &showHidden=`1` to your call, etc etc. Hope you find something there that helps solve your issue. If not, then do post your call here, tell us how you’re using it and what you and tell us what you’re expecting the output to be versus what you’re actually getting on the page.
          • 21606
          • 46 Posts
          Thank you both for your quick replies...
          First fail was creating the blog using Shaun McCormick’s instructive tutorial...I was very careful to copy the elements for the template page, post info, in which I modified my target (Blog home) to - in my case resource 13 (maybe I need a new number eh? - just joking!), set up the tags, created the sections (resources 11 & 12 in my site), added a blog post in each section. the blog post pages work just fine, but the aggregate page, blog Home doesn’t.

          To answer Mary’s question - I had remembered reading your excellent tutorial just a few days ago so when the blog didn’t work I went straight there and used your examples - including unhiding the resources that I’d hidden from the menu. No luck. I even went to another website and created a dummy page just to test getResources alone - no luck.

          I’m building a new blog site with only the elements of the tutorial on my local machine right now and am hoping to come across something that will shed some light on what I’m doing incorrectly.

          Any other way to test or kick this thing in the butt to make it work? I know it’s me just missing something... I’ll be staring at this post hoping for that tidbit that will get me over this hump!! shocked
            • 8609
            • 607 Posts
            hmm, this might sound silly, but can you confirm that you actually do have getResources installed?
              • 21606
              • 46 Posts
              grin yep...already ran across that error...but I just found this in my error log after enabling the debug:

              [2011-05-29 22:09:06] (ERROR @ /index.php) SELECT `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override` FROM `site_content` AS `modResource` WHERE ( ( modResource.parent IN (13) AND (modResource.context_key IN (’web’) OR EXISTS(SELECT 1 FROM `context_resource` ctx WHERE ctx.resource = modResource.id AND ctx.context_key IN (’web’))) ) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 ) ORDER BY publishedon DESC LIMIT 5

              It only seems to happen on the page with getResources - am running this:

              [[!getResources? &showHidden=`1` &includeContent=`1` &debug=`true`
              ]]
                • 3749
                • 24,544 Posts
                I think you need both a &tpl pproperty and a &parents property in the snippet tag.
                  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
                  • 21606
                  • 46 Posts
                  Thanks Bob, will ensure that those bases are covered. Just to help I’m working in these environments:


                  Apache version 2.2.17
                  PHP version 5.2.15
                  MySQL version 5.1.52
                  MODx versions: 2.1, 1.08, and 1.04pl2

                  Home config:
                  XPSP3
                  xampp 1.7 (not sure if it’s the latest - will make sure!)

                  Tests have been in each one of these so I must be missing a critical piece of information. Using the doc info at http://rtfm.modx.com/display/ADDON/getResources all that’s necessary to even get bad results is [[getResources]] on the page.
                  All MODx versions have been verified to have the latest version of getResources as well.
                  Commands tried:

                  [[!getResources? &showHidden=`1` &includeContent=`1` &debug=`true`]]

                  from the blog instructions (http://rtfm.modx.com/display/revolution20/Creating+a+Blog+in+MODx+Revolution)
                  [[!getResourcesTag?
                  &element=`getResources`
                  &elementClass=`modSnippet`
                  &tpl=`blogPost`
                  &hideContainers=`1`
                  &pageVarKey=`page`
                  &parents=`[[*id]]`
                  &includeTVs=`1`
                  &includeContent=`1`
                  ]]
                  [[!+page.nav:notempty=`
                  <div class="paging">
                  <ul class="pageList">
                  [[!+page.nav]]
                  </ul>
                  </div>
                  `]]

                  Plus am working through the examples on http://rtfm.modx.com/display/ADDON/getResources except that I don’t have a myRowTpl chunk defined so don’t use it(suggestions for content for that will be gladly accepted), but anything else that looks like it may work is in progress.

                  Oh yes and my browsers are the latest versions of Chrome, FireFox, Opera, IE7(just for laughs)

                  thanks in advance for any suggestions, folks!

                    • 21606
                    • 46 Posts
                    Eureka! - well, almost...
                    Using
                    [[!getResources? &parents=`0` &limit=`5` &tpl=`blogPost` &includeContent=`1`]]

                    I get content - but - if any other parent is used for example the resource that contains the blog posts there are no results.

                    So, I’m like, half happy dancing now...
                      • 3749
                      • 24,544 Posts
                      It should work equally well with any &parents setting as long as the parent has children and the children are published and not protected by any ACL (permission) entries.
                        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