We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    While I understand that backticks allow for single and double-quotes, why aren’t they optional? In PHP (as if you guys were unaware smiley ), if you want to include a single quote, you just wrap things in double quotes and vice versa. It seems that I should be allowed to choose that, because the backticks are pretty inconsistent with most of what I’ve used in the past. Is there an option that I need to turn on?

    This is killing my troubleshooting, because I’m no longer sure what needs to be in backticks and what doesn’t.
      • 10487 MODX Staff
      • 1,535 Posts
      There’s no option - the backticks are essential to the document parsing process to be able to identify when one snippet parameter value ends and another parameter starts. Simple rule of thumb is that all snippet parameter values should be surrounded by backticks.

      IMO, it’s better sometimes to go with a fixed convention than to try and make everything optional/configurable and end up adding a whole lot of logic to account for that - especially during the page load when parsing efficiency and speed are important factors.
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 22303 MODX Staff
        • 10,725 Posts
        Actually, the backticks are optional, but are there so you can put whitespace in between the parameters. Without the backticks, your tag parameters would have to be strung together without extraneous whitespace, exactly like a query string, i.e.
        [[snippet?param1=value&param2=another value&param3=1&param4=xxx]]

        vs.
        [[snippet? &param1=`value` &param2=`another value` &param3=`1` &param4=`xxx`]]
          • 34162
          • 1 Posts
          "no option." That’s the spirit. smiley

          Thanks for the info and the alternate method. This alternate method can have no spaces in it, correct? Even in the attributes?
            • 14050
            • 788 Posts
            Quote from: OpenGeek at Aug 08, 2007, 11:03 PM

            [[snippet?param1=value&param2=another value&param3=1&param4=xxx]]

            vs.
            [[snippet? &param1=`value` &param2=`another value` &param3=`1` &param4=`xxx`]]


            If you look at the code examples he provides, param2=another value demonstrates that the attributes may have whitespace.
              Jesse R.
              Consider trying something new and extraordinary.
              Illinois Wine

              Have you considered donating to MODx lately?
              Donate now. Every contribution helps.