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

    I'm new to posting to the forum, so please let me know if I'm in the wrong place for asking this. I was wondering how to append string to template variable values. For example I want

    List: TVex1, TVex2, TVex3,


    reading the documentation the closest that I saw was the filter for :after. However I don't want to add another value just to append a comma at the end of each value for output. Here is what I'm trying to accomplish:

     List:[[*TVex:tvLabel:append=`,`]]


    Is there a filter or property I can use to do this?

    Thank you for any help!
      • 3749
      • 24,544 Posts
      Could you put all the values in a single TV, either as a text TV with the comma-separated values, or a list TV.

      If you want to use your existing TVs, you can also just put the commas outside the TV tags:

      List: [[*TV1]],[[*TV2]],[[*TV3]]
        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
        • 51815
        • 5 Posts
        Quote from: BobRay at Feb 16, 2018, 12:29 AM
        Could you put all the values in a single TV, either as a text TV with the comma-separated values, or a list TV.

        If you want to use your existing TVs, you can also just put the commas outside the TV tags:

        List: [[*TV1]],[[*TV2]],[[*TV3]]

        Hey Bob,

        Thanks for the reply. The only issue I'm having when trying to do this, is that I have a TV calling multiple Text Labels in a list TV. So I wanted to to append the comma to the Text Label itself in the TV. I found a workaround though of just placing the comma in the Label. However if there is a way to do this, that would be awesome to know! smiley
          • 3749
          • 24,544 Posts
          Sorry, I can't make any sense out of your question. I mentioned two separate solutions, so I don't know what you mean by "trying to do this" and "if there is a way to do this".

          This sentence is particularly mysterious to me, though maybe I'm just being dense:

          I have a TV calling multiple Text Labels in a list TV. So I wanted to to append the comma to the Text Label itself in the TV.


          Some concrete examples might help me make sense of your question.
            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
            • 51815
            • 5 Posts
            Quote from: BobRay at Feb 28, 2018, 11:30 PM
            Sorry, I can't make any sense out of your question. I mentioned two separate solutions, so I don't know what you mean by "trying to do this" and "if there is a way to do this".

            This sentence is particularly mysterious to me, though maybe I'm just being dense:

            I have a TV calling multiple Text Labels in a list TV. So I wanted to to append the comma to the Text Label itself in the TV.


            Some concrete examples might help me make sense of your question.

            Sorry about the confusion regarding the question. I didn't word it properly. Essentially I wanted this to happen:

            Input Option Values: TVLabel==Value1||TVLabel2==Value2||TVLabel3==Value3||  
            
            List:[[*Tv:tvlabel:append=`,`]]
            

            What it outputs:
            List: TVLabel, TVLabel2, TVLabel3,
            
            


            I just added a comma at the end of each label to get around this. Hopefully that example made a little more sense. Thanks for the input though! smiley