We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36818
    • 119 Posts
    Hi all,

    getResources gives me a lot of flexibility, but isn't that flexible when it comes to the following problem:

    1. I want to aggregate resources into one document
    2. the resources should be formatted via chunk templates
    3. I created differnt chunks (e.g. tpl1, tpl2, tpl3, ...)
    4. therefor I created a TV (text) where the templatename for each resource is stored.

    What I want to do is to pass the value of the TV to getResources and that it renders me the resource with the attached template.

    I thought that with the options &includeTVs and &processTVs the TVs are filled into an array and that I could pick the data from there. Something like this:

    //Definition of the added Option
    $passedTVValue = !empty($passedTVValue) ? $passedTVValue : '';
    
    //pick the data from the $properties-array
    $dynamicTpl = $properties[$tvPrefix . $passedTVValue];
      
    //render the resource with this Tpl 
    if (!empty($passedTVValue) && empty($resourceTpl)) $resourceTpl = parseTpl($dynamicTpl, $properties);


    But: no luck.

    Can anyone advise me how to get the result I wish?

    all the Best
    f.

    This question has been answered by achterbahn. See the first response.

    • discuss.answer
      • 36818
      • 119 Posts
      Me again...

      Problem solved. (guess I slept not enough)

      It was easier than I thought. I could pass a new Option to the snippet:

      [[!getResourcesAltTpl? 
      &tplAltTV =`SubartikelTemplate`


      and processed it with:

          $tplAltTVx = $properties[$tvPrefix . $tplAltTV];
          if (!empty($tplAltTV) && empty($resourceTpl)) $resourceTpl = parseTpl($tplAltTVx,$properties);
      


      Best.
      F.