We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26334
    • 77 Posts
    I have some code that includes in it a javascript array of latitude and longitude points. As a result I get code like this:

    [[-32.77638,151.33979],[-32.72544,151.32582],[-32.73685,151.30053],[-32.73953,151.2627],[-32.77255,151.30316],[-32.8076,151.28101]]

    modx sees this as a snippet call for a snippet called:
    -32.77638,151.33979],[-32.72544,151.32582],[-32.73685,151.30053],[-32.73953,151.2627],[-32.77255,151.30316],[-32.8076,151.28101

    and hence it all gets stripped out.

    I can’t see any way of escaping the snippet replacement of the [[ ]] and content in between.

    It is not an option to have the array present as:
    ([-32.77638,151.33979],[-32.72544,151.32582],[-32.73685,151.30053],[-32.73953,151.2627],[-32.77255,151.30316],[-32.8076,151.28101])

    as it is passing to a hosted 3rd party application so I have to pass in the format they use.

    How do I go about not having the array parsed into a snippet call? (have tried the ` escape character but that then passes as `[[ or [`[ which of course breaks the call to the remotely hosted app.

    Thanks.
      • 5340
      • 1,624 Posts
      Try Brackify. It might work for you

      Edit: You will have to use [ [ instead of [[
        • 26334
        • 77 Posts
        Thanks. Wrote something similar to that but was trying to avoid parsing every page this way via a package. Hoping to do it just for the page (pages) needed.

        Oh well. Works.
          • 26903
          • 1,336 Posts
          You could write a plugin for this, either check for specific id’s or some kind of unique page marker on the page pre render event say, then run the snippet only if found.
            Use MODx, or the cat gets it!
            • 3749
            • 24,544 Posts
            I think there’s a relevant plugin here: http://modxcms.com/forums/index.php?topic=31435.0
              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
              • 32699 ☆ A M B ☆
              • 427 Posts
              I had this issue with something else.

              Simply did this to get by the parser:
              var sorting = [0,1]; 
              $("table").tablesorter( {sortList: [sorting]} );
              
                Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com