We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1944
    • 12 Posts
    Hi guys, i ran into a problem today. I want to give a template variable to snippet as argument, but i was unable so far. Here is how it goes:

    [!products? &cat=’X’ &lang=’[*my_tmpl_variable*]’ !]

    I tried *,[,! nothing worked. Is there even a way to parse this variable for the current page?
      • 33337
      • 3,975 Posts
      The parameters of snippet call are enclosed in back ticks " ` ", not single quotes. smiley
      [!products? &cat=`X` &lang=`[*my_tmpl_variable*]` !]
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 1944
        • 12 Posts
        Quote from: zi at Jul 06, 2010, 11:18 AM

        The parameters of snippet call are enclosed in back ticks " ` ", not single quotes. smiley
        [!products? &cat=`X` &lang=`[*my_tmpl_variable*]` !]


        Thanks for the correction i missed this, but still the variable is not passed to the snippet
          • 33337
          • 3,975 Posts
          Which snippet you are using? Is it from MODx extras section or custom built?
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 1944
            • 12 Posts
            Quote from: zi at Jul 06, 2010, 11:35 AM

            Which snippet you are using? Is it from MODx extras section or custom built?

            Custom build basically the first variable works, just the part where I’m accessing the Template Variable is not working.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              If you’re using it as a parameter like that, it should be available automatically as $lang.
                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
                • 1944
                • 12 Posts
                Quote from: sottwell at Jul 06, 2010, 11:56 AM

                If you’re using it as a parameter like that, it should be available automatically as $lang.

                The problem is even using it directly (i.e. [[languageIdentifier]]) i get no result. This variable is a part of multi-language system mod. Here on the forums.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  What output does your TV produce (if you just have the TV in your content, what does it display)?
                    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
                    • 1944
                    • 12 Posts
                    Quote from: sottwell at Jul 06, 2010, 12:13 PM

                    What output does your TV produce (if you just have the TV in your content, what does it display)?

                    No output, nothing. And i can see in the Content page that there is assigned value to the variable.
                      • 1944
                      • 12 Posts
                      Is it even possible to access template variable and to return the value for the current page?