We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39355
    • 26 Posts
    My apologies because I dont know what to call this outcome in order to search for it better.

    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.
      • 17301
      • 932 Posts
      Is the user making their selection on a previous page? IF so then I'd suggest sending the params in the URL and then using a snippet to grab that query and output it as the necessary chunk.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 17301
        • 932 Posts
        I haven't tested it but I'd imagine it would be something like this...

        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]]
          ■ email: [email protected] | ■ website: https://alienbuild.uk

          The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
          • 3749
          • 24,544 Posts
          I'm probably misunderstanding the question, but if it's about using a different Tpl chunk depending on the value of a TV, putting the desired chunk name in the TV and doing this should work:

          [[!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.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting