On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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.
    • 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: lk@alienbuild.uk | ■ 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.
      • 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: lk@alienbuild.uk | ■ 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.
        • 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