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

    I though this would be easy, but I can't get my head round it!

    I have a number of chunks:
    [[$chunk_A]]
    [[$chunk_B]]
    [[$chunk_C]]
    


    Then I have a listbox TV called [[*selector]] so the user can choose which chunk to display with the following values:
    A||B||C
    


    Then in my template I want to display the selected chunk - which is where I've got stuck.
    I thought I could do something such as:
    [[$chunk_[[*selector]]]]
    


    But this doesn't work.

    It's probably a schoolboy error, but I can't work out what I've done wrong!

    Thanks
    Andy

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

      • 38783
      • 571 Posts
      Is the user selecting the chunk to display from the Manager/backend, or are they making the selection in a front end form?
        If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

        email: [email protected] | website: https://andytough.com
        • 4172
        • 5,888 Posts
        this should work, usually

        do you get the right value with
        [[*selector]]
        alone?
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
        • discuss.answer
          • 4172
          • 5,888 Posts
          you could also have input - options like

          A==[[$chunk_A]]||B==[[$chunk_B]]||C==[[$chunk_C]]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 51020
            • 670 Posts
            Quote from: andytough at Jul 20, 2017, 12:07 PM
            Is the user selecting the chunk to display from the Manager/backend, or are they making the selection in a front end form?

            It's in the manager they are selecting it.
              • 51020
              • 670 Posts
              Quote from: Bruno17 at Jul 20, 2017, 12:15 PM
              you could also have input - options like

              A==[[$chunk_A]]||B==[[$chunk_B]]||C==[[$chunk_C]]

              yes I get the right value with i just call the [[*selector]]. I will try and add the chunks directly to the options - will report back! Thanks as ever!
                • 51020
                • 670 Posts
                Quote from: Bruno17 at Jul 20, 2017, 12:15 PM
                you could also have input - options like

                A==[[$chunk_A]]||B==[[$chunk_B]]||C==[[$chunk_C]]

                That worked! I was overthinking it - Cheers Bob!