We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3729
    • 32 Posts
    Hi. I’ve pasted and adapted a getResources call from the revo docs.
    The call I’ve copied is here:
    http://rtfm.modx.com/display/revolution20/Creating+a+Blog+in+MODx+Revolution#CreatingaBloginMODxRevolution-Addinga%22LatestPosts%22widget


    My call looks like this:
    [[!getResources? 
      &parents=`20`
      &hideContainers=`1`
      &limit=`3`
      &sortby=`publishedon`
      &tpl=`latestPostsTpl`
    ]]
    


    The template "latestPostsTpl" exists.

    What could be going wrong?

      • 22019
      • 390 Posts
      What’s in your latestPostsTpl?

      Is there anything for getResources to find (ie published resources that are not containers under resource 20)? I can’t remember what you have to do wrong that triggers this issue, but it will be easily fixable (when I remember what it was!).
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
        • 5340
        • 1,624 Posts
        From the getResource documentation

        Calls without a &tpl property specify will just output an array listing of each resulting Resource and their fields.
          • 3729
          • 32 Posts
          The template contains this code, copied straight from the page in the docs:

          <li>
            <a href="[[~[[+id]]]]">[[+pagetitle]]</a>
            [[+publishedon:notempty=`<br /> - [[+publishedon:strtotime:date=`%b %d, %Y`]]`]]
          </li>
          
            • 3729
            • 32 Posts
            Quote from: odeclas at Nov 25, 2010, 07:23 AM

            What’s in your latestPostsTpl?

            Is there anything for getResources to find (ie published resources that are not containers under resource 20)? I can’t remember what you have to do wrong that triggers this issue, but it will be easily fixable (when I remember what it was!).

            Yes, there are a couple of non-container documents under resource 20.
              • 22019
              • 390 Posts
              Cipa’s response rings a bell - check the case and spelling of your tpl chunk name - I think it’s the same behaviour if it can’t find the specified tpl.
                Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                • 25663 MODX Staff
                • 12,272 Posts
                And make sure there’s no extra spaces. There’s a 99.9% chance it’s a problem with the template chunk name.
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 15558
                  • 108 Posts
                  if you’re reading this and if Ryan’s reply doesn’t fit to you, please be sure that you didn’t quick-create or quick-edit the needed template by pasting its code in the "Description" field. Yes that just happened to me. Now beat me if my post is useless kiss
                    Sorry for that ⇧ , I'm no dev but I wanna try