문제

I was wondering if anyone knew a way to retrieve, say the first 5 (eg: 1 -5) resources of a parent with one getResource line, the retrieve the next 5 (6 - 10) with another getResources line? Kind of like pagination.

I was unable to find something to do this in the documentation.

도움이 되었습니까?

해결책

You want to use the offset and limit properties. Offset is used to skip a specified number of resources returned by the query criteria:

[[!getResources? &parents=`[[*id]]` &tpl=`myRowTpl` &limit=`5`]]

[[!getResources? &parents=`[[*id]]` &tpl=`myRowTpl` &limit=`5` &offset=`5`]]

다른 팁

You might want to look into combining getPage and getResources as this will do the pagination for you...

http://rtfm.modx.com/display/ADDON/getResources#getResources-UsinggetPageforPagination

http://rtfm.modx.com/display/ADDON/getPage

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top