We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • So I’ve come across an error I can’t seem to figure out.

    You can see the first mention of the problem here on another PHx thread:

    http://modxcms.com/forums/index.php/topic,7522.msg161722.html#msg161722 (no solution was provided for the problem the best I can tell).

    According to the system info, the version of mysql Client API version for this server is: 5.0.32

    When using Ditto and PHx together, I get this error message:

    Parse error: syntax error, unexpected ’;’ in /homepages/35/d159529503/htdocs/XXXXXXX/furniture/assets/plugins/phx/phx.parser.class.inc.php(266) : eval()’d code on line 1

    I’ve got another website with PHx and Ditto running together doing math and this problem does not occur. Here’s the math code on the server I’m having problems with:
    <p>savings: $[+list_price:math=`?-[+product_price+]`+]</p>

    When the page has been cached, the error message does NOT appear. When I clear the cache and refresh the page, the error message shows up again. When the error shows up on the page and I simply click refresh, the error goes away. So obviously when it is cached, this problem is not occurring.

    On both sites I’m using the most recent version of PHx (2.1.3). The site I’m having the problem with is using MODx version 0.9.6.2 and the site without the problem is using 0.9.6.1p2. Both sites are using PHP Version 4.4.9. Also the site that is NOT having the problem with the PHx call is using mysql Client API version 5.0.67

    One other thing to mention, in both sites, I have the document cached and Ditto cached (i.e. [[Ditto]] vs. [!Ditto!). I’ve tried every combination to play with it, but with the same result.

    Anyone have a guess why this is happening?
      Precision Web Development ... SmashStack.com
      • 587
      • 3 Posts

      Not sure if you ever figured this out, but perhaps this may help others as well. Using ifempty worked for me in cases where product_size2 has no value.

      [+phx:math=`[*product_size2:ifempty=`0`*]/16`+]


      Perhaps this will work for you (Not tested. Not sure if works with Ditto placeholders.):

      <p>savings: $[+phx:math=`[+list_price:ifempty=`0`+]-[+product_price:ifempty=`0`+]`+]</p>