我想按菜单索引来排序我的资源,并有以下代码:
[[!getResources? &parents=`50` &sortdir=`ASC` &sortby=`menuindex` &limit=`100` &includeTVs=`1` &processTVs=`1` &tpl=`temp` ]]
但是 sortby
无法正常工作。
谁知道我做错了什么?
谢谢!
最佳答案
如果您阅读文档,您会发现 sortby
字段必须编码为 JSON 字符串。 http://rtfm.modx.com/display/ADDON/getResources
如果你想按 menuindex 排序,这应该可行:
[[!getResources? &parents=`50` &sortdir=`ASC` &sortby=`{"menuindex":"DESC"}` &limit=`100` &includeTVs=`1` &processTVs=`1` &tpl=`temp` ]]
关于ModX Revo : getResources not sorting by menu index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12291441/