We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10076
    • 1,024 Posts
    Hi I have a strange problem, it looks as if on save of a template the tags are changed in PHP like tags,

    This is what I paste into the template field:
    <base href="[(site_url)]" />
      <meta http-equiv="Content-Type" content="text/html; charset=[(modx_charset)]" />
      <meta name="robots" content="index,follow" />
      <link rel="stylesheet" type="text/css" href="[(site_url)]assets/templates/amnesia/css/style.css" />
      <title>[(site_name)] - [*pagetitle*]</title>
    </head>
    
    <body>
    
    <div id="headercont">
    	<div id="header">
    		



    the result after a save, and note the slashes:
      <base href=\"[(site_url)]\" />
      <meta http-equiv=\"Content-Type\" content=\"text/html; charset=[(modx_charset)]\" />
      <meta name=\"robots\" content=\"index,follow\" />
      <link rel=\"stylesheet\" type=\"text/css\" href=\"[(site_url)]assets/templates/amnesia/css/style.css\" />
      <title>[(site_name)] - [*pagetitle*]</title>
    </head>
    
    <body>
    
    <div id=\"headercont\">
    	<div id=\"header\">


    Any ideas??

    Thanks, Frank.
      • 26931
      • 2,314 Posts
      i guess it’s magic_quotes related -> http://modxcms.com/forums/index.php?topic=40996.0
        • 10076
        • 1,024 Posts
        I ll try that however, I was just trying out a new template. The site is live with a template (i dare not open right now) that is normal?

        Thanks.
          • 10076
          • 1,024 Posts
          Host has magic quotes ON, can not be turned off, so now what? Was able to setup my website, plus some more templates so far. Any suggestions?
            • 26931
            • 2,314 Posts
              • 10076
              • 1,024 Posts
              That returns an internal server error. Maybe I will just reinstall modx, i dont know anything else. The host is looking into it.

              thanks, Frank.
                • 10076
                • 1,024 Posts
                Well no result so far. Strand the site has been running on this host for a few months now.
                Only installed YAMS, recently? Anyone? Again this is what happens when saving divs: </div>
                <div id=\"headercont\">
                <div id=\"header\">

                Maybe run the template as a snippet, I dont know, joking off course,

                fr.
                  • 26931
                  • 2,314 Posts
                  Only installed YAMS, recently
                  maybe ask in the YAMS forum as well
                    • 10076
                    • 1,024 Posts
                    Some additional info:

                    php info:
                    PHP Version 5.3.1

                    This server is protected with the Suhosin Patch 0.9.8
                    Copyright (c) 2006-2007 Hardened-PHP Project Copyright (c) 2007-2009 SektionEins GmbH
                      • 22851
                      • 805 Posts
                      I too would suspect magic quotes. There are no regular expressions within YAMS that would have that kind of effect that I know of and YAMS does not interfere with the process of saving a template.

                      Three ways to disable magic quotes that I know are:
                      1. Turn off the PHP magic quotes within the php.ini... but you probably don’t have access/permissions for that.
                      2. Turn off the PHP magic quotes using Apache config (.htaccess) as was mentioned previously:
                          # Disable Magic Quotes
                          php_flag magic_quotes_gpc Off
                          php_flag magic_quotes_runtime Off
                          php_flag magic_quotes_sybase Off
                      

                      3. Remove the extra quotes added by PHP manually by executing the following PHP code before any $_POST, $_GET, $_COOKIE, or $_REQUEST variables are used.
                            // Disable magic quotes manually
                            if (get_magic_quotes_gpc())
                            {
                              if ( ! function_exists( 'stripslashes_deep' ) )
                              {
                                function stripslashes_deep($value)
                                {
                                  $value = is_array($value) ?
                                      array_map('stripslashes_deep', $value) :
                                      stripslashes($value);
                        
                                  return $value;
                                }
                              }
                      
                              $_POST = array_map('stripslashes_deep', $_POST);
                              $_GET = array_map('stripslashes_deep', $_GET);
                              $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
                              $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
                            }
                      

                      I’m not sure where the best place to put this would be... Sounds like a hack, but the best place would probably be to edit the MODx index.php and place it right at the top.

                      It might be worth disabling the YAMS and managermanager plugins one at a time to see if that effects the problem with the quotes too.

                      EDIT: By the way, it sounds like you are using a release candidate of MODx? It’s probably best to upgrade to the final release, just in case it is a bug that got fixed.
                        YAMS: Yet Another Multilingual Solution for MODx
                        YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                        Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.