-
- 63 Posts
Hi,
I want to display a list of documents using getResources sorted by the way they are sorted in the Resources list. So if the user moves a Resource (document) to another position, the list made by getResources should reflects that.
For example, my Resources list has the following ID:
Overview ID:20
Detail 1 ID:33
Detail 2 ID:34
Detail 3 ID:35
If the editor moves the resources this way:
Overview ID:20
Detail 2 ID:34
Detail 1 ID:33
Detail 3 ID:35
the list made by getResources should be exactly as this second option.
Can anybody help me to find it out?
Thank you in advance.
-
- 390 Posts
Add &sortby=`menuindex` to your getResources call.
Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
-
- 63 Posts
Thank you odeclas for your answer.
The &sortby code seems to work but the other way around. For example, I have these Resources order:
Overview ID:20
Detail 1 ID:33
Detail 2 ID:34
Detail 3 ID:35
But in the website, the resources are displayed exactly inverse:
Overview ID:20
Detail 3 ID:35
Detail 2 ID:34
Detail 1 ID:33
Am I missing some extra code?
Thanks again.
-
- 63 Posts
I found it!
I just need to use the code:
&sortdir=`ASC`
Default is:
&sortdir=`DESC `