MODX Community

Pdoresources: show resources in specified order (sorted by hand)


How do I specify the exact order in which pdoresources lists the results?

I’d like to display a list with &resources=`9,3,6` and get resources 9,3 and 6 in that order. Possible?

This might work?


If not, you can sort on any TV, so for instance can set the menu index for those resources to 1, 2, 3 respectively, and then use:



Nope, that throws an error:

Fatal error : Uncaught TypeError: Argument 1 passed to pdoFetch::replaceTVCondition() must be of the type array, null given

(Sorting with menuindex is no option here)


&sortby=`FIELD(, 4,7,2,5,1 )` &sortdir=`ASC`

Maybe needs brackets?


Bingo! (strange, this was the first thing I tried and it did not work then … )


@lucy Sorry, still errors. But Brunos version works!

Awesome, glad you got it working. I just found it in the docs for getResources. I often forget to look there but I think there are more examples than in the pdoResources docs.