質問

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