We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19873
    • 67 Posts
    I have a fairly small template, about 150 lines. When I save it, the progress bar cycles 4 times. i.e. it takes a long time to save. When I view the template, however, it is truncated in the middle of a comment, with a % appended as the last character.

    I cleared my sites cache. The DB seems to be performing correctly otherwise.

    Has anyone seem this behavior?

    Okay, I seem to have identified a symptom. I am using HTML5Boilerplate, which give me the following code:

    <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="assets/components/reignitioninc-ver2/js/libs/jquery-1.7.1.min.js"><\/script>')</script>


    Removal of the last line that falls back to the local version of jQuery causes MODx to save very slowly. Removing it allows for saving in a 10th the time.

    Anyone know why? [ed. note: mmcglynn last edited this post 13 years, 8 months ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Sounds like some kind of server security configuration, not allowing a POST that wants to write javascript code like that.
        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
        • 19873
        • 67 Posts
        I assume that the template is getting saved as a text file, so that HTML and script files would not be caused to fire. If they did, that would cause quite a mess, no?

        There is likely some checking of the template programmatically, but then why wouldn't an error be thrown, rather than just cutting the end of the file off?

        Any MODx devs have an explanation?

        [ed. note: mmcglynn last edited this post 13 years, 7 months ago.]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Unless you specified it to be static, it gets saved to the database.

          That wasn't my point, however. Servers can be configured with security applications such as mod_security and suhosin. These scan POST values and decide whether or not to allow certain strings submitted in forms to pass in the POST. They often refuse things relating to email, and javascript that writes to the page would also be a likely candidate. http://blog.modsecurity.org/2010/09/advanced-topic-of-the-week-xss-defense-via-content-injection.html

          How the servers will react to anything on their "blacklist" differs according to how the server is configured. All of this is done by the server before MODx ever gets the incoming request.
            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
            • 19873
            • 67 Posts
            Thank you for the explanation. So the server is evaluating the POST action and rejecting it for cause by truncation. Makes sense!