modxmodx-getresources

MODX getResources displays child resources of unlisted resource


I have the following getResources code on a page:

[[!getResources? 
                &resources=`57,77`
                &depth=`1`
                &tpl=`customersListTPL` 
                &limit=`99`  
                &sortdir=`ASC`  
                &includeTVs=`1`  
                &processTVs=`1`
                &includeContent=`1`
                &showHidden=`1`
                &depth=`0`  
                &sortby=`menuindex`  
            ]]

I want it to only display data from the resources 57 and 77, but it is also displaying child resources from the resource this is on too.

Anyway I can stop that?


Solution

  • For some design-reason getResources will allways mix results from the defined parents (explicit or implicit) if the &parents config is not set.

    If you only want to use the defined &resources you have to explicitly disable the parents by using:

    &parents=`-1`
    

    For reference: That's not the only oddity of getResources, the limit is preset to 5 and the sort order is createdon=DESC (for example).


    Manual: https://rtfm.modx.com/extras/revo/getresources#getResources-Examples