PHx - MODX Community Forums <![CDATA[ [SOLVED] PHX triggers event log: $modx->recordCount() is deprecated function]]>
} else if ($modx->recordCount($result) == 0){ // If snippet not found, look in the modifiers folder

This only appears to have started happening after installing the MODX 1.0.15 update.

Does this mean PHX needs updating? It also appears to be used by AjaxSearch as well.]]> Wed, 21 Jan 2015 02:12:11 +0000
<![CDATA[Display if manager user]]>
Essentially I want to be able to include links for manager users for help pertaining to particular pages, or possibly include a link to a Ditto listing for the manager to jump to & edit that page using QM+ (otherwise the listing would just be text and not a public accessible link.)

I have found a few similar questions in the forum but did not see a solution–I apologize if I just missed it.

Thanks!]]> Thu, 08 May 2014 05:17:27 +0000
<![CDATA[Evo 1.0.13rc2 - Error : Undefined index: webInternalKey]]> When I set on errors (config/user/detection/detact all) I see:

Error : Undefined index: webInternalKey


1	DocumentParser->executeParser()
index.php on line 144
2	DocumentParser->prepareResponse()
manager/includes/ on line 1621
3	DocumentParser->parseDocumentSource()
manager/includes/ on line 1711
4	DocumentParser->invokeEvent()
manager/includes/ on line 1487
5	DocumentParser->evalPlugin()
manager/includes/ on line 3393
6	eval()
manager/includes/ on line 1006
7	PHxParser->PHxParser()
manager/includes/ : eval()'d code on line 5

]]> Thu, 13 Feb 2014 07:47:15 +0000
<![CDATA[PHx Fresh Install... Fatal Error Cannot redeclare class...]]>
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/ 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]]> Tue, 13 Aug 2013 06:16:51 +0000
<![CDATA[PHx 2.2.0-rc "@" bug]]>
I think I found a bug in the newly release PHx 2.2.0 RC. In some cases if text contains the @ sign the parser stops working

	<div class="row">

I also attached an image to show how it looks. Note the @ sign in the text. Same thing works with the previous PHx version

]]> Sat, 18 May 2013 12:04:52 +0000
<![CDATA[Why does PHx evaluate the "else" clause when it's false?]]> On a product page there’s a chunk that shows all of the product’s attributes.
So a PHx statement evaluates the template id and picks the correct TV for each attribute. Here’s the code:


The problem is that for every product only one TV exists. I would expect that in the example above PHx would evaluate from left to right and if the "eg=`22`" condition is true would output the value and stop. But it doesn’t. It continues to evaluate the statement in the "else" clause, finds the "optionsPerm2Roof" tv, and since it doesn’t exist throws this error:

« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[*optionsPermRoof*]) AND sc.published=1 AND sc.deleted=0) AND (' at line 3 »
      SQL: SELECT DISTINCT FROM `smartspacedb`.`modx_site_content` sc LEFT JOIN `smartspacedb`.`modx_document_groups` dg on dg.document = WHERE ( IN ([*optionsPermRoof*]) AND sc.published=1 AND sc.deleted=0) AND (sc.privateweb=0) GROUP BY
      [Copy SQL to ClipBoard]
Parser timing
  MySQL: 	0.0100 s	(14 Requests)
  PHP: 	0.1448 s	 
  Total: 	0.1548 s

If i change "optionsPermRoof" in the else clause to "optionsTempRoof", i.e. a TV that exists everything works fine. Is there a way to force PHx to stop evaluating after a true condition has been met?
]]> Mon, 22 Apr 2013 06:10:26 +0000
<![CDATA[How to add values of two TVs]]>
I would like to display a value on page which is simply two TVs added together.

I have a TV called initialpayment and another called finalpayment.  I want to add them together and display on a page.

I’ve never used PHX before.  I’m assuming this is a job for PHX?  I suspect I’m stuck on the syntax.  I’ve tried about a hundred variations can’t seem to get it right.  I get either a parse error or no value is displayed.  Can someone show me how its done?

Here’s the latest I’ve tried.

<p>[*projectcost:math?`[*initialpayment*]+[*finalpayment*]`*]</p>]]> Wed, 13 Feb 2013 10:45:52 +0000
<![CDATA[ [SOLVED] PHx AND and OR help please]]>
            <li title="depth">[+maxigallery.picture.depth:htmlent+]d </li>

but I get always the unwanted output. What's wrong?
I also tested this code, where I would like to suppress any ouput if the values are not present:
but I have no output both with any value present that none.
What's wrong with my code? thank you
]]> Mon, 12 Mar 2012 03:41:25 +0000
<![CDATA[help with PHx in a form ("selected" option value)]]> selected="selected" to opiton values based on their value, but my code doesn't work:
            <label for="[+maxigallery.fieldnames.unit+]">units:</label> 
            <select name="[+maxigallery.fieldnames.unit+]" id="[+maxigallery.fieldnames.unit+]" value="[+maxigallery.picture.unit:htmlent+]" onkeydown="document.editform.[+maxigallery.fieldnames.modified+].value='yes'">
                <option value="mm" [+maxigallery.picture.unit:htmlent:is=`mm`:then=`selected="selected"`+]>mm</option>
                <option value="cm" [+maxigallery.picture.unit:htmlent:is=`cm`:then=`selected="selected"`+]>cm</option>
                <option value="m" [+maxigallery.picture.unit:htmlent:is=`m`:then=`selected="selected"`+]>m</option>
                <option value="variable" [+maxigallery.picture.unit:htmlent:is=`variable`:then=`selected="selected"`+]>variable</option>

no one of the values has the attribute. Where am I wrong?
This is a template of a Maxigallery (beta) module, on evo.]]> Thu, 08 Mar 2012 10:41:58 +0000
<![CDATA[moved server and PHx just stopped working]]>
I recently moved an Evo 1.0.5 site to a new server and PHx has stopped working. Haven't changed a thing with PHx in the manager, but any data previously generated by PHx is just not appearing at the new location.

Here's the current server setup:
Apache version 2.2.21
PHP version 5.3.8
MySQL version 5.1.56-log

The phx directory is set to 755, Template Service Events set at OnParseDocument.

Here's the previous server setup:
Apache: 2.2.3
PHP version 5.2.17
MySQL version 5.0.77

Could the server difference here be causing the problem?

Thanks in advance]]> Mon, 23 Jan 2012 08:00:58 +0000
<![CDATA[PHx and Reflect]]>
Reflect Call (BTW I’ve tried this cached/uncached):
[!Reflect?  &id=`reflectArchive` &config=`@FILE {{template-path}}configs/reflect/testimonial-archive.config.php`!]

Inside the Reflect Template PHP:
$tplItem ='@CODE <li class="reflect_month"><a href="[~[+parent+]~]#testimonial_[+id+]" title="[+pagetitle+]" class="reflect_month_link">[+pagetitle+][+description:ucase+]</a>[+wrapper+]</li>'

When I remove the :ucase modifier, the [+description+] placeholder appears, so there is data in there. Forcing PHx on in the template has no effect.]]> Mon, 09 Jan 2012 04:09:09 +0000
<![CDATA[PHX not working after saver update]]>
However on now updating our website content the PHX used within template seems to stops working which of course completely messes up our site templates.

At current we are unable to make any changes to the site as this simply stops PHX from functioning.

Any ideas on where within PHX we should start looking for issues?]]> Thu, 22 Dec 2011 07:25:50 +0000
<![CDATA[PHx and EasyEvents]]>
I’ve activated PHx and EasyEvent doesn’t work anymore.
chunk which works with PHx off:

[!EasyEvents_ListMini? &nodes=`103`!] 

chunk, which I thought it could work:


[+phx:input=`[!EasyEvents_ListMini? &nodes=`69`!]`+] 

I really don’t know what I’m doing undecided]]> Mon, 19 Dec 2011 05:37:50 +0000
<![CDATA[PHx, Template Variables and Wayfinder]]>
If its 1 then this means to hide the entry from the sitemap.

[+sitemap_exclude+] -- 
<a href="[]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>[+wf.wrapper+]</li>

The problem is:

1) If I do this:


Nothing ever appears.

I am trying to figure out what I am doing wrong with respects to the PHX, I want it to do this:

1. If the [+sitemap_exclude+] = 1 then show the list-item in my Wayfinder &rowTpl

But for some reason it doesn’t work.

What is the correct way of doing this?]]> Sun, 20 Nov 2011 12:57:47 +0000
<![CDATA[Modx Evo, getchunk & PHX]]>
I’m trying to call a chunk with placeholder.

It’s working only for classic placeholder, not for test with PHX.
Example :
$modx->setPlaceholder('id', $row["id"]);
$modx->setPlaceholder('pagetitle', $row["pagetitle"]);
$modx->setPlaceholder('description', $row["description"]);
$modx->setPlaceholder('introtext', $row["introtext"]);
$resultat.= $modx->getChunk('mytpl');

And mytpl :
 <div class="texte">
            <td class="titre">
              <h2><a href="/[~[+id+]~]" title="[+longtitle+]">[+pagetitle+]</a></h2>
            <td class="description">
              [+phx:if=`[+description+]`:is=``:then=``:else=`<a href="/[~[+id+]~]" title="[+longtitle+]">[+description+]</a>`+]
              <a href="/[~[+id+]~]" title="[+longtitle+]">[+introtext+]</a></p>
              <p class="date"><a href="/[~[+id+]~]">[[afficheDate? &id=`[+id+]`]]</a></p>

The PHX is not executed ...

Do you have any idea this problem ?

Thanks for helping

Cyril]]> Tue, 02 Aug 2011 04:32:35 +0000
<![CDATA[PHx parse error]]>
PHx is working just perfect but their is a little issue. When I’ve it enabled online and change any settings in the admin panel, siteCache file is changed and show the local server path.

If I disable PHx, then it does not happen.

Here is the error:

« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »

PHP error debug
Error: include_once(D:/phpserv/www/clickedsol/assets/plugins/phx/ [function.include-once]: failed to open stream: No such file or directory
Error type/ Nr.: Warning - 2
File: /home/design4m/public_html/apps/clickedsol/manager/includes/ : eval()’d code
Line: 9

Parser timing
MySQL: 0.0013 s (3 Requests)
PHP: 0.0203 s
Total: 0.0217 s]]> Fri, 24 Jun 2011 10:41:49 +0000
<![CDATA[PHx Error]]>
I am trying to install PHx on MODx Revolution 2.0.8-p traditional, however I keep getting the following error

Fatal error: Class ’PHxParser’ not found in /home/creative/public_html/modx-2.0.8-pl/core/cache/elements/modplugin/3.include.cache.php on line 25

I am not really sure how to fix can anyone help??? is it that i am just installing in the wrong place??

Thanks in advance

Louise]]> Thu, 09 Jun 2011 11:24:26 +0000
<![CDATA[ [SOLVED] Revo equivalent of PHX for the math function]]>
Easy with PHx, but does anyone know the equivalent in Revo output modifiers? Can’t see anything in the documentation.


EDIT sorry just saw the math function in Output Modifiers... whoops!]]> Mon, 23 May 2011 05:01:33 +0000
<![CDATA[IF snippet or Output Filters (PHx)?]]> I wonder which one is better to use. The IF snippet or generally output filters (in Revo) or PHx in Evo?
I tried to benchmark performance (timings), but can’t really tell..

Does anyone know the difference / which one is faster?

Jakub]]> Sat, 30 Apr 2011 12:36:22 +0000
<![CDATA[SOLVED phx parser error]]>
When im logged in and preview the website i get these errors below.
When i refresh that page the error is gone.
When i clear cache the error comes back, it’s only when im logged into the cms!

Modx 1.0.5 with phx 2.1.4 and phx:phpthumb 0.3

Parse error: syntax error, unexpected ')' in /usr/home/nwebbrbkvv/domains/ : eval()'d code on line 1

Parse error: syntax error, unexpected ')' in /usr/home/nwebbrbkvv/domains/ : eval()'d code on line 1

]]> Wed, 20 Apr 2011 07:16:19 +0000