We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37946
    • 70 Posts
    I have 2 TVs with an input type of textarea. Each TV belongs to a different resource group.
    Within that texarea could be anything - including text (surprise).

    Currently, I have this markup:

    TV a:
    <li>Thing A</li>
    <li>Thing B</li>
    


    TV b:
    <li>Thing A</li>
    <li>Thing C</li>
    


    Giving me a final output of:
    <li>Thing A</li>
    <li>Thing B</li>
    <li>Thing A</li>
    <li>Thing C</li>
    


    "Thing A" is the exact same thing. When output - its cast as a string. (Again, no suprise). However, I would only like to show 1 instance of "Thing A".

    So my final output ideally would look like this:
    <li>Thing A</li>
    <li>Thing B</li>
    <li>Thing C</li>
    


    Is there a way to filter the values of the TV? Given that it's a string I'm guessing that could be difficult?

    Thank you!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Break the string into an array, remove the redundancies from the array, then concat the array back into a string.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 4172
        • 5,888 Posts
        can you tell us a bit more about the contents of your textarea-TVs?

        perhaps there are better ways, than using textareas for your situation.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 37946
          • 70 Posts
          @sottwell - Thank you! I will give that a try!

          @Bruno17 - Think of each TV as a user group.
          "TV a" user group only sees what is loaded into "TV a" and so on.

          Sometimes, there might be a case where there is a user that can belong to "TV a" and "TV b".

          In which case, you will get duplicate "things" as i have tried to describe above.

          ...clear as mud. smiley

          Thank you both for your time!
            • 4172
            • 5,888 Posts
            can't you use Resources for each thing, or entries in a custom-table?
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 37946
              • 70 Posts
              That's a valid point. Maybe I need to re-think my strategy.