We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29635
    • 361 Posts
    Every couple of weeks I run into PHx just outputting the actual PHx call and not what it should be doing. I usually spend 30 minutes making sure my syntax is correct and such, then I remember that PHx barfs when it sees a CDATA tag (specifically, the ]]> sequence).

    Once I figure it out I remove the CDATA tags and proceed, but this time I figured I’d bring it up in the forums. Has anybody else noticed this, and if so, any fixes? I’ve searched but I only see one reference to it with no answers.
      Need MODx Ecommerce? Try FoxyCart!
      • 33337
      • 3,975 Posts
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 29635
        • 361 Posts
        Yeah. It’s not in that list but the ]] is definitely the culprit. I’ve updated the wiki page.

        In case anybody wants a workaround, a quickie is to write your ]]> as ].]> and then add a plugin to replace them OnWebPagePrerender:
        //<?php
        // Begin plugin code
        $e = &$modx->event;
        
        $id = $modx->event->params['id'];
        
        if ($e->name == 'OnWebPagePrerender') {
        	$o = &$modx->documentOutput; // get a reference of the output
        	$o = str_replace('/* ].]> */', '/* ]]> */',$o);
        }
        $e->output($o);
        return '';

          Need MODx Ecommerce? Try FoxyCart!
          • 20413
          • 2,877 Posts
          THANK YOU! cool
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 33337
            • 3,975 Posts
            Nice work Brett laugh
              Zaigham R - MODX Professional | Skype | Email | Twitter

              Digging the interwebs for #MODX gems and bringing it to you. modx.link
              • 32540
              • 19 Posts
              Thanks for the plug-in tip. Unfortunately, the plug-in doesn’t seem to be executing OnWebPagePrerender. I’m getting this error:

              XML Parsing Error: unclosed CDATA section
              


              The XML fragment looks like this: <section title="What I Did"><![CDATA[ Foo ].]></section>
                • 36723
                • 94 Posts
                First of thanks for the plugin. But can you elaborate on getting the plugin working? I tried this code and it does not seem to work?

                I checked OnWebPagePrerender, did variants of the spacing of ’/* ].]> */’ also and it still does not work.

                Any suggestions?

                //<?php
                // Begin plugin code
                $e = &$modx->event;
                
                $id = $modx->event->params['id'];
                
                if ($e->name == 'OnWebPagePrerender') {
                	$o = &$modx->documentOutput; // get a reference of the output
                	$o = str_replace('/* ].]> */', '/* ]]> */',$o);
                }
                $e->output($o);
                return '';
                
                  • 29635
                  • 361 Posts
                  What error are you getting? Same as above? And what v of MODx? I haven’t used this code in a while so I’m not sure if perhaps something has changed lately.
                    Need MODx Ecommerce? Try FoxyCart!
                    • 36723
                    • 94 Posts

                    In my logs, I am getting "Parse error: syntax error, unexpected ’<’ in ...httpdocs/manager/includes/document.parser.class.inc.php(746) : eval()’d code on line 1"
                      • 29635
                      • 361 Posts
                      Do you have
                      //<?php
                      in your plugin? Try removing that? Odd.
                        Need MODx Ecommerce? Try FoxyCart!