<![CDATA[ Getresources to display chunk depending on TV (and default tpl) - MODX Community Forums]]> https://forums.modx.com/thread/?thread=101911 <![CDATA[Getresources to display chunk depending on TV (and default tpl)]]> https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549483
The outcome I am hoping to do:

Getresource displays different chunk that depends on TV. If "tv A" is selected, getResources displays "chunk A". If "tv B" is selected, getresources displays "chunk B".

Thank you for your time.]]>
jmanson Mar 17, 2017, 11:53 AM https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549483
<![CDATA[Re: Getresources to display chunk depending on TV (and default tpl)]]> https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549514
[[!getResources? tpl=`[[*TvName]]` ]]



If you have to compute the chunk name based on the value in the TV, you can do that with an output modifier inside the TV tag, or with a custom snippet.]]>
BobRay Mar 19, 2017, 10:24 PM https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549514
<![CDATA[Re: Getresources to display chunk depending on TV (and default tpl)]]> https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549485
If TV A is selected then add the chunk name at the end of the submit url

&query=tvAselected

Then Create a snippet called getQuery and paste in the following code:

<?php
if (isset($_GET['query'])){
   $modx->setPlaceholder('query',$_GET['query']);
}


In your getResources call set the tpl to this:

&tpl=`[[+query]]`


Finally make sure you're calling the snippet on your page before the getResources call.

[[!getQuery]]
]]>
lkfranklin Mar 17, 2017, 12:02 PM https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549485
<![CDATA[Re: Getresources to display chunk depending on TV (and default tpl)]]> https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549484 ]]> lkfranklin Mar 17, 2017, 11:57 AM https://forums.modx.com/thread/101911/getresources-to-display-chunk-depending-on-tv-and-default-tpl#dis-post-549484