Nested pdoResources / Using place holder to able use it in another pdoResources call

Summary

Hello,

Im trying to create a nested template/chunk structure. My idea is to able to use template variable as selection for &tpl=`` in pdoResource call in the same chunk like below:

  [[pdoResources?
        &parents=`[[+id]]`
        &depth=`0`
        &limit=`0`
        &where=`[{"template:=":5}]`
        &includeTVs=`fbRowLayoutType`
        &prepareTVs=``
        &sortby=`{"menuindex":"ASC","pagetitle":"ASC"}`
        &showHidden=`1`
        &tpl=`[[+tv.fbRowLayoutType]]`
    ]]

and this does not work.

I have also tried to do two pdoResource call one to get the value and save it placeholder and use it in next call (all in the same chunk):

  [[pdoResources?
        &parents=`[[+id]]`
        &depth=`0`
        &limit=`0`
        &where=`[{"template:=":5}]`
        &includeTVs=`fbRowLayoutType`
        &sortby=`{"menuindex":"ASC","pagetitle":"ASC"}`
        &showHidden=`1`
        &toPlaceholder=`fbRowType`
        &tpl=`@INLINE [[+tv.fbRowLayoutType]]`
    ]]

    [[pdoResources?
        &parents=`[[+id]]`
        &depth=`0`
        &limit=`0`
        &where=`[{"template:=":5}]`
        &includeTVs=`fbRowLayoutType`
        &prepareTVs=``
        &sortby=`{"menuindex":"ASC","pagetitle":"ASC"}`
        &showHidden=`1`
        &tpl=`[[+fbRowType:htmlent]]`
    ]]

Outputing just [[+fbRowType]] as works but not if i try to use it in pdoResources call…

Is there any way how to achieve that? Or maybe I’m missing something?

Thanks guys!

Maybe you can use the properties &tplCondition and &conditionalTpls.
Something like this:

[[!pdoResources?
    ...
    &includeTVs=`fbRowLayoutType`
    &tplCondition=`tv.fbRowLayoutType`
    &conditionalTpls=`{"tplA":"tplA","tplB":"tplB"}`
]]

In the property &conditionalTpls, list the values of the TV and the name of the corresponding template chunk you want to use.

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.