We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23950
    • 78 Posts
    Hello

    I just installed PHx exactly as said in the documentation and i have this error:
    Fatal error: Cannot redeclare class PHxParser in /homez.63/acbsesam/v2/assets/plugins/phx/phx.parser.class.inc.php on line 12

    Line 12:
    class PHxParser {


    MODx Evo 1.0 / YAMS 1.1.7 RC7 / MM 0.3.4 / PHx 2.1.3
    PHP 5.2.11 / MySQL 5.0.68
      [b] MES SITES SOUS MODx
      • 9994
      • 133 Posts
      I have the exact same problem. Evo 1.0.1 PHx 2.1.3 YAMS rc8 alpha (unreleased version of PMS)

      It has something to do with calling or including 2x the same I think.
      When u uncheck OnParseDocument this error isnt there but i think it won’t work then.

      Let me know if u know more!

        Best CMS eva!
        • 22851
        • 805 Posts
        Hi there. Have you seen and done this from the readme.txt for YAMS?


        If using the PHx snippet then please note the following. For some reason, a file
        specified using include_once gets reincluded and this causes the PHxParser class
        to be redefined, which generates a PHP parse error. This can avoided by modifying
        the PHx snippet to wrap the include in some code that will only include the file
        if the class has not yet been defined:

        if ( ! class_exists( ’PHxParser’ ) )
        {
        include_once $modx->config[’rb_base_dir’] . "plugins/phx/phx.parser.class.inc.php";
        }

        Cheers.
          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.
          • 9994
          • 133 Posts
          Indeed, no more error message for me!
          Thanx.
            Best CMS eva!
            • 23950
            • 78 Posts
            same here. Works fine smiley Thanks PMS u rock!!
              [b] MES SITES SOUS MODx
              • 22851
              • 805 Posts
              @bs.

              In the next version of PHx would it be possible to

              1. wrap the PHxParser class in an
              if ( ! class_exists( 'PHxParser' ) ) { ... }


              2. change the include_once to and include in the PHx snippet call.

              I believe that this would avoid the problem mentioned above when using YAMS, but would not affect PHx.

              Thank you.
                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.
                • 33238
                • 388 Posts
                This one Works for me!!!

                if(class_exists('PHxParser') != true)
                {
                include_once $modx->config['base_path'] . "assets/plugins/phx/phx.parser.class.inc.php";
                }


                Hope that helps you too!
                  --
                  ysanmiguel.com