We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I notice that getResources skips all documents with an empty content field using this tpl:

    Title: [[+pagetitle]]<br />


    I created a bunch of resources with just pagetitles to play with it and it took me a while to figure out why only a few of them were retrieved by getResources.
      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
      • 4172
      • 5,888 Posts
      hmm... I tested it with:

      [[getResources? &parents=`2`&tpl=`pagetitle`&limit=`999`&depth=`1`]]


      and it shows all resources, also these with empty content.
      But it showed me also childchilds (goes 2levels deep from parent), so I changed

      $depth = !empty($depth) && ($depth = intval($depth)) ? $depth : 10;

      to
      $depth = !empty($depth) && ($depth = intval($depth)) ? $depth-1 : 10;


      what seems to fix this issue
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: BobRay at Oct 30, 2009, 01:31 AM

        I notice that getResources skips all documents with an empty content field using this tpl:

        Title: [[+pagetitle]]<br />


        I created a bunch of resources with just pagetitles to play with it and it took me a while to figure out why only a few of them were retrieved by getResources.
        I don’t understand what you mean BobRay; it doesn’t skip anything because it doesn’t have a content field for sure.

        Also, Bruno17, that issue was reported elsewhere and will be addressed in the next release, though it should be depth=`0` which currently you cannot pass in due to the !empty() check.
          • 4172
          • 5,888 Posts
          IMO, if I go one level deep (&depth=`1`) from parent I want to show only the direct childs, as it is in getChildIds or as it was in Ditto, too???
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 3749
            • 24,544 Posts
            OK, I see what’s happening.

            There are two issues:

            1. I assumed that &limit=`0` would give me all of them, but it only gives five. I’m not sure what it should do, but probably not that.

            What confused me is that putting any content in the content filed moves a document onto the list of five shown.

            This must have to do with the sort order, but all the docs were published to begin with so saving them shouldn’t affect publishedOn, which is the stated default for sorting.

            2. I looked in the DB and confirmed that saving a document updates both editedOn and publishedOn to the current timestamp (I’ll Jira that).

              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