We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24278
    • 165 Posts
    Good Day Fiends,

    I have a multi-select TV defined for a template. But, when multiple values are selected, ditto 1.0.1 outputs them without a space between the values... (e.g. if I chose Apple and Orange... then ditto outputs them as AppleOrange)

    How can add a comma (, ) between the output values (e.g. Apple, Orange).

    best regards,

    -Raavi
      • 11975
      • 2,542 Posts
      Hi,

      quite easy smiley

      In the template variable settings choose: widget -> delimited list

        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 6726
        • 7,075 Posts
        Even more fun, you can choose the delimiter smiley

        You could choose to wrap those item with whatever hmtl you need, be it p, li...
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 24278
          • 165 Posts
          Thanks guys!

          The flexibility and detailing of this software never ceases to amaze me. I am totally impressed by it.

          One small question... ho do I separate the output (values) with , and a space (e.g. Apple, Orange and not Apple,Orange)

          -Raavi
            • 18397
            • 3,250 Posts
            ,

            NOTE: I typed a space after the comma.
              • 24278
              • 165 Posts
              Thank you Mark!

              But, when I add the space after the comma... the output still remains Apple,Orange. It does not output as expected.

              I even tried   but that did’nt work either.

              -Raavi
                • 11975
                • 2,542 Posts
                Hi,

                if you wish you can use this piece of code to manage the ouput:

                $newString = str_replace(",",", ",$tvName);
                $newString .= ".";
                return $newString;
                


                Save it as a new snippet and call it as follow : [[snippet? &tvName=`[*myTVcommaSeparated*]` ]]

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 24278
                  • 165 Posts
                  Thanks heliotrope.

                  -Raavi
                    • 24278
                    • 165 Posts
                    Hi,

                    The suggestion only works when the snippet is called uncached [[...]]
                    Save it as a new snippet and call it as follow : [[snippet? &tvName=`[*myTVcommaSeparated*]` ]]
                    Is there a way of caching the output?

                    best regards,

                    Raavi
                      • 18397
                      • 3,250 Posts
                      MARKSVIRTUALDESK Reply #10, 20 years ago
                      Raavi,

                      [[ calls for a cached snippet
                      [! calls for an uncached snippet