We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1526
    • 72 Posts
    when in YAMS readme I read:
    6. PHx Setup
    ------------

    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";
    }


    Also, please remember that the Plugin Execution Order must be edited to place
    YAMS in first place - that is before PHx - on all associated events.
    What does it mean exactly? What shall I do? Where?
    I found a PHx plug in, but not a PHx snippet.

    I'm having a
    Fatal error: Cannot redeclare class PHxParser in […]/public_html/assets/plugins/phx/phx.parser.class.inc.php on line 12
    in pages that use a template with some self-made multi-language TVs (a paint picture, size, thecnique (multilanguage) and other relevant data), there is JOT (minimal call, ate the moment), but not PHx to my Knowledge.
    More precisely, somethimes I get the page coming from the menu, then I get the error switching language.
    Thanks for any help [ed. note: andrearicci last edited this post 14 years, 11 months ago.]
      MODx evo 1.5~1.6 ✪ Apache v 2.2.22 ✪ PHP v 5.3.10 ✪ MySQL v 5.1.61
      <°'iiii);
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The plugin is meant. Open the plugin and add the wrapper if(!class_exists... to the plugin code.
        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
        • 1526
        • 72 Posts
        Thank you.
        Is this correct?
        original PHx:
        //<?php
        /**
         [comments removed]
         */
        
        include_once $modx->config['rb_base_dir'] . "plugins/phx/phx.parser.class.inc.php";
        
        $e = &$modx->Event;
        
        $PHx = new PHxParser($phxdebug,$phxmaxpass);
        
        switch($e->name) {
        	case 'OnParseDocument':
        		$PHx->OnParseDocument();
        		break;
        
        }

        becames:
        //<?php
        /**
         [comments removed]
         */
        
        if ( ! class_exists( 'PHxParser' ) )
        {
         include_once $modx->config['rb_base_dir'] . "plugins/phx/phx.parser.class.inc.php";
        }
        
        $e = &$modx->Event;
        
        $PHx = new PHxParser($phxdebug,$phxmaxpass);
        
        switch($e->name) {
        	case 'OnParseDocument':
        		$PHx->OnParseDocument();
        		break;
        
        }
        

        Is that ok?
        I'm still getting the same error.
        EDIT:
        The page display as expected once the cache is cleared an i reach it from the menu. Once there, if I switch language I get the errror; if I go back without clearing the cache, I get the error.
        Thanks for your help. [ed. note: andrearicci last edited this post 14 years, 11 months ago.]
          MODx evo 1.5~1.6 ✪ Apache v 2.2.22 ✪ PHP v 5.3.10 ✪ MySQL v 5.1.61
          <°'iiii);
          • 1526
          • 72 Posts
          the problem was the Jot call - removed it and Modx works.
          I changed the Jot call as in YAMS How To
          YAMS + Jot
          but still got the error sad
          So, is my problem a conflict between Jot and PHx? How to fix it?.
          Thanx [ed. note: andrearicci last edited this post 14 years, 11 months ago.]
            MODx evo 1.5~1.6 ✪ Apache v 2.2.22 ✪ PHP v 5.3.10 ✪ MySQL v 5.1.61
            <°'iiii);
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Jot and Ditto both have their own phx libraries; they don't need the PHx plugin.
              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