-
☆ A M B ☆
- 104 Posts
This might be a long shot, but if it’s throwing the sortby field right into the sql... this *might* work with mysql:
&sortby=`FIND_IN_SET(id, ’comma,separated,id,list’)
&sortdir=`desc`
This would work assuming getResources uses IN (comma,separated,id,list) for the query (I suspect it does).
Good luck!
-
☆ A M B ☆
- 179 Posts
Quote from: TomMLS at Mar 29, 2011, 02:02 PM
Quote from: dj13 at Mar 29, 2011, 01:59 PM
Try this:
&sortby= = 'FIELD(modResource.id, 4,7,2,5,1 )';
Ohhhhhh...that looks awesome.
Better yet, should not require any code changes.
Plus all one must do is publish or unpublish a document to have it appear or not appear.
Yes, that worked PERFECTLY! Thanks dj13! But where does your mighty vodoo come from? "FIELD"? Never heard of. "modResource.id" same for this. Something in the docu that I missed? Do you have a reading hint for me? ;-)
BTW: I created a chunk containing "FIELD(modResource.id,[[*related]])", with the TV "related" containing the comma seperated list of IDs. And with this the getResources-call says "... sortby=’[[ $relatedHelper]]’ ...". Works fine. Then I got an idea:
@openGeek: Wouldn’t it be nice to have this implemented directly into getResources, e.g. "... sortby=’resources’ ..."? Shouldn’t be to tough to code. ;-)
-
☆ A M B ☆
- 179 Posts
Quote from: OpenGeek at Mar 29, 2011, 03:27 PM
Quote from: mindeffects at Mar 29, 2011, 03:20 PM
@openGeek: Wouldn’t it be nice to have this implemented directly into getResources, e.g. "... sortby=’resources’ ..."? Shouldn’t be to tough to code. ;-)
It will be indeed be implemented 
Hoorayyy!!!
wow, this is great.
I didn’t know about this FIELD function for sorting.
http://dev.mysql.com/doc/refman/5.0/en/sorting-rows.html
search for: Posted by Eamon Daly on March 28 2005 6:16pm
-
☆ A M B ☆
- 179 Posts
@MODX: "Have I told you lately that I love you?"
Boy, am I glad I switched to MODX!!!
Quote from: mindeffects at Mar 29, 2011, 03:14 AM
Using "... &sortby=’resourses’ ..." is NOT working at all. Also GitHub isn’t much of a help: https://github.com/opengeek/getResources/pull/23
That pull request could not be merged. But
there is a working one awaiting integration. I’ve been using it successfully for few moths now.
Quote from: OpenGeek at Mar 29, 2011, 03:27 PM
Quote from: mindeffects at Mar 29, 2011, 03:20 PM
@openGeek: Wouldn’t it be nice to have this implemented directly into getResources, e.g. "... sortby=’resources’ ..."? Shouldn’t be to tough to code. ;-)
It will be indeed be implemented 
It’s waiting to be merged already. So, don’t hesitate
This is the web: the only thing you know about who will come is that you don't know who will come.