We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10208 ☆ A M B ☆
    • 1,780 Posts
    [[!getResources? &parents=`31` &tpl=`groupRowTpl` &sortby=`menuindex` &sortdir=`ASC` &limit=`15`]]


    The above displays the resources under parent 31 in descending order. According to the tree AND the actual menuindex field. Unless I'm mistaken, descending means top to bottom. Setting it DESC displays them from bottom to top.

    Weird huh?

    Something else...

    I've got two resources that are behaving badly. getResources seems to be at the root of the problem, or at least affected by it.

    Interestingly enough, it depends upon where I place it in the tree. If I stick it into a hidden folder, publish it, unhide it and view it, it works fine. But if I place it into it's rightful spot, a simple getResources call set to [ [ *id ] ] pulls in children at one call, and can't find the [ [ *id ] ] to process an email TV in another call.

    Offending button chunk:
    <a href="#" class="button radius group" data-reveal-id="page_lightbox" data-animation="fade">Contact SBSNW [[$thisGroup]]</a>


    Offending getResources chunk:
    [[getResources?
    &resources=`[[*id]]`
    &tpl=`groupNameRowTpl`
    ]]


    groupNameRowTpl
    [[+pagetitle]]


    (I can't get +pagetitle to display any other regular way, not in the button chunk, nor the getResources parameter. getResources was my solution.)

    Assuming the page is wigged, I attempted to recreate it:

    I first duplicated a working resource (identical code- sibling - diff content), this did not work. Then, created a whole new resource from scratch, re-entered content and TV's, etc. This new resource works fine.

    The wonked resource in question functioned just fine before. The only reason I was messing with it was because the contact form stopped sending emails. At which point I notice the other problem. The contact form contains another getResources call in the modal view to grab the [ [ *id ] ] and entered email from a TV, but even setting the id to `32` directly did not allow it to grab the TV.

    It did however work when I set a default email address for the TV, and it sent to that default. That's great for a fallback but not what I need.

    Weird part is that multiple duplicate sibling resources with duplicate everything, except content & title, etc. work just fine. And I duplicated these working siblings from the wigged resource in the first place. Back when it worked prior to upgrading to 2.2.5.


      Frogabog- MODX Websites in Portland Oregon
      "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
      Having server issues? These guys have MODX Hosting perfected - SkyToaster
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The above displays the resources under parent 31 in descending order. According to the tree AND the actual menuindex field. Unless I'm mistaken, descending means top to bottom. Setting it DESC displays them from bottom to top.
      ASC means from smallest ID to largest (1 -> 2 -> 3); DESC means from largest value to smallest (3 -> 2 -> 1). I get these mixed up all the time.

      Are you sure you're not getting your [[+ placeholders confused with your [[* resource settings? The one will be applied to each resource getResources is processing, the other will only apply to the resource the getResources snippet is on (the current resource). So if you have [[* in a getResources tpl, it will repeat the same value (or nothing at all, if the current resource doesn't use the TV or doesn't have a value set for 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
        • 3749
        • 24,544 Posts
        I think &parents=`-1` will prevent it from getting the children.


        ------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using.
        MODX info for everyone: http://bobsguides.com/modx.html
          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
          • 10208 ☆ A M B ☆
          • 1,780 Posts
          Quote from: sottwell at Oct 17, 2012, 02:09 AM
          The above displays the resources under parent 31 in descending order. According to the tree AND the actual menuindex field. Unless I'm mistaken, descending means top to bottom. Setting it DESC displays them from bottom to top.
          ASC means from smallest ID to largest (1 -> 2 -> 3); DESC means from largest value to smallest (3 -> 2 -> 1). I get these mixed up all the time.

          OK, makes sense. kinda.... but ok since the menuindex is set that way (not the ID's) ASC is my new friend when I want resources to display just like they live in the tree.

          Are you sure you're not getting your [[+ placeholders confused with your [[* resource settings? The one will be applied to each resource getResources is processing, the other will only apply to the resource the getResources snippet is on (the current resource). So if you have [[* in a getResources tpl, it will repeat the same value (or nothing at all, if the current resource doesn't use the TV or doesn't have a value set for it).

          No, I don't think I got that confused, but it's worth noting for sure, thank you. It may be due to the child resources being unpublished actually. I published another and it showed up so I've got to hide it. It's a protected resource, which apparently isn't honored by getResources.

          Bob's parameter works. Now the only problem is, why can't that resource grab it's own TV setting and email the correct mailbox while the new one and all the duplicates I created from it can?




            Frogabog- MODX Websites in Portland Oregon
            "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
            Having server issues? These guys have MODX Hosting perfected - SkyToaster