We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42066
    • 16 Posts
    I do not believe that the following problem has anything to do with the Modx system but rather the server it rests on. But if there is anyone that contribute any knowledge is welcomed. I have made several websites all with Modx but the sites are with different service providers, all reputable. Two of the Modx websites are with one particular provider, lets call it host provider A. When I built the sites and continued to manage them A there as no problems at first (they have been up for a couple of years). However two days ago I was working one of these sites on provider A, and a very strange thing happened. Whenever I saved something, whether a Template or Chunk or Snippet, the code was re-written! That's right, re-written! Backslashes appeared in all of the tags! So I panicked then I checked the other sites on the other providers to see if it was a glitch in the Modx system. They worked fine. Apparently it only occurred on provider A. So I decided to re-install the Modx and upgrade to 1.06 on one the sites on provider A. (My sites are still running with 1.05). After upgrading, it happened again! I checked the other site that is also on provider A and it also had the problem. Finally I had to do my work directly on the database. I contacted provider A with details of the problem and they have no idea what is wrong. (Incidentally I emailed my client begging them to change service providers). Here is an example of what happens:

    This is my template before I saved it:


    <head>
    <title>[(site_name)] | [*pagetitle*]</title>
    <meta http-equiv="Content-Type" content="text/html; charset=[(modx_charset)]" />
    <base href="[(site_url)]" />
    <link rel="stylesheet" href="assets/templates/css/style.css" type="text/css" media="screen" />
    </head>
    </head>
    <body>
    <div id="wrapper">
      <div id="container">
        <div id="top"> </div>
        <div id="content">
          <h3>[*longtitle*]</h3>
              [*content*]

         </div>
       <div id="nav">{{nav}}

         <div class="lowercase">{{news}}</div>
       </div>
      </div>
    </div>
    </body>
    </html>


    This is my template after I saved it:


    <head>
    <title>[(site_name)] | [*pagetitle*]</title>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=[(modx_charset)]\" />
    <base href=\"[(site_url)]\" />
    <link rel=\"stylesheet\" href=\"assets/templates/css/style.css\" type=\"text/css\" media=\"screen\" />
    </head>
    </head>
    <body>
    <div id=\"wrapper\">
      <div id=\"container\">
        <div id=\"top\"> </div>
        <div id=\"content\">
          <h3>[*longtitle*]</h3>
              [*content*]

         </div>
       <div id=\"nav\">{{nav}}

         <div class=\"lowercase\">{{news}}</div>
       </div>
      </div>
    </div>
    </body>
    </html>

    As you all can see, backslashes appear in the tags. This happens whenever I save anything! Pretty weird huh?
    Anybody know why?

    zinggimaging [ed. note: zinggimaging last edited this post 11 years, 5 months ago.]
    • That's likely magic_quotes_gpc; ask the host if they recently upgraded PHP and if they made sure it was OFF.
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 40447
        • 165 Posts
        I think Mark H. is right. Why don't you run a php script that will show you exactly how php is configured on your hosting provider to see if it matches your needs. Also turn off TinyMCE rich text editor via Elements => Manage Elements => Plugins => TinyMCE => System Events. My experience is that TinyMCE adds erratic code to your pages while editing and messes up your site. Best thing is to handcode or use a decent editor that doesn't add any unwanted or hidden code to your edits. I recommend bluefish editor.
        http://bluefish.openoffice.nl/index.html
          • 42066
          • 16 Posts
          How do I run php script? Also it can't be the TinyMCE because even when it is off, the problem occurs. It also happens when updating the snippets. But I will definitely look into the Bluefish editor.
          • Contact your host about magic_quotes_gpc, they'll know what that is and how to disable it on your account. They might have some info in their knowledge base as well.

            While TinyMCE doesn't create nice code, it doesn't randomly add slashes before quotes - that's magic_quotes_gpc.

            The php script sitecms is talking about is phpinfo(), which already exists in your manager. I think it's reports > system info, but I have to say it's been a while since I saw an Evo manager from the inside.
              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
              • 42066
              • 16 Posts
              Thanks everyone!
                • 40447
                • 165 Posts
                Yes it is phpinfo(). If your run this script inside a webpage on your hosting provider it shows you exactly the php version and how your hosting provider has configured php. Then you compare this how php is configured on your local developing server (such as xampp or wamp). If there are important differences between the two, such as magic_quotes_gpc as Mark H. pointed out then you found most likely the problem. It is recommended to google for more php scripts that can diagnose a website to find possible differences between your local and hosted website. There are tons of free php scripts on the net that can help you with that. Google is your friend.
                  • 40447
                  • 165 Posts