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

    long time no post but...

    How do you avoid clients editing pages with a text editor that has a snippet call in them, my experience is that this normally breaks the snippet by changing a & into an & (currently experienced with FormIt)

    I turn off the editor but there must be a cooler way.

    Thanks,
    Taff
      Adrian Lawley: www.adrianlawley.com
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      1. Put the snippet call in a chunk and use the chunk tags in your editable content.

      2. Use an external configuration file for the snippet so the only parameter in the snippet call is the config file; with only one parameter you don't need the & at all. Apparently formit doesn't have the ability to use an external config file huh

      3. Make a copy of the snippet to customize and set the argument values in the snippet code, then use your customized copy. [ed. note: sottwell last edited this post 14 years, 8 months ago.]
        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
        • 22303 MODX Staff
        • 10,725 Posts
        External config files are not recommended. This is what PropertySets were created for. That said, you could also isolate the portion of content in a Chunk or TV that you hide from the user via security or form customization.
          • 29181
          • 480 Posts
          Thank you both for your comments. I'm liking the chunk idea a lot.

          Easy when you know how!

          Cheers,
          Taff
            Adrian Lawley: www.adrianlawley.com
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Property sets. Hm. Will look into that. I had thought these were global to all uses of the snippet, but if they can be customized on a per-use basis then they would be most useful.

            Yes! Excellent! http://rtfm.modx.com/display/revolution20/Properties+and+Property+Sets

            I would strongly recommend this rather than putting the snippet in a chunk. Less awkwardness figuring out where stuff is coming from, as well as less processing for MODx to do when generating the page. [ed. note: sottwell last edited this post 14 years, 8 months ago.]
              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
              • 29181
              • 480 Posts
              ok, I'll take a look. Thanks again
                Adrian Lawley: www.adrianlawley.com