0

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.

Yoshi
  • 54,081
  • 14
  • 89
  • 103
LeoWolff
  • 29
  • 1

1 Answers1

1

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.

Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
  • 1
    Thnx for your comment. Reading the rtfm and some other posts, I've solved the puzzle using the following code: &tplCondition=`template` &conditionalTpls=`{"7":"overzichtTpl", "27":"overzichtAdvTpl"}`. Your help made me think it over again and put me on the right track. It works perfect now!!! – LeoWolff Jan 28 '16 at 18:44