LeoWolff
LeoWolff

Reputation: 29

modx revo getresources multiple templates

Is it possible to use multiple tpl's in the getResources call?

This is my code so far:

[[!getPage?
  &element=`getResources`
  &tpl=`overzichtTpl`
  &parents=`2, 74`
  &hideContainers=`0`
  &showHidden=`1`
  &limit=`50`
  &sortby=`RAND()`
  &depth=`0`
  &includeTVs=`1`
]]

What I want to achieve is the folowing: the resource call

&parent=`2`

has to use

&tpl=`overzichtTpl`

and the

&parent=`74`

has to use

&tpl=`overzichtAdvTpl` 

Furthermore I want to have the output from both calls displayed at random. (otherwise I only have to use 2 seperate getResources calls). For example like this: resource-call

If you have the solution, I'm looking forward to hear from you.

Upvotes: 0

Views: 394

Answers (1)

Sean Kimball
Sean Kimball

Reputation: 4494

This is clearly documented using tpl_N & tplnN:

https://rtfm.modx.com/extras/revo/getresources

If you need to randomize your templates, write a snippet and execute it from the getResources call (i.e. &tpl=`RandomizeChunkName`) You don't need an extra wrapper chunk.

Upvotes: 1

Related Questions