Topic: Support/Comments for PHx  (Read 69947 times)

Pages: 1 ... 6 7 [8] 9 10 11   Go Down

#141: 27-Jun-2007, 04:24 AM

Testers

Dimmy
Posts: 2,001

Я не говорю по-русски 私は日本語を話さない

WWW
Armand is very busy being a dad for the first time. I don't think anyone would object, and personally think it's a great idea. Smiley

Understandable then!! I'll tidy up the files and upload them to the repository.


Did you also include the hack: http://modxcms.com/forums/index.php/topic,14306.msg96738.html#msg96738

so that placeholders used in snippetcalls are not removed by phx?

#142: 29-Jun-2007, 09:14 AM

Testers
ncrossland
Posts: 241

Armand is very busy being a dad for the first time. I don't think anyone would object, and personally think it's a great idea. Smiley

Understandable then!! I'll tidy up the files and upload them to the repository.


Did you also include the hack: http://modxcms.com/forums/index.php/topic,14306.msg96738.html#msg96738

so that placeholders used in snippetcalls are not removed by phx?

Didn't know about that, but I will merge it in before I upload.
Author: ManagerManager plugin - customise your ModX manager interface

#143: 29-Jun-2007, 11:22 AM

Moderator

bS
Posts: 398

WWW
FYI: using the hack will result in  PHX not being recursive.
The reason phx takes on the placeholders is because it needs to resolve the value when they are nested.
Armand Pondman
MODx Coding Team
:: Jot :: PHx

#144: 29-Jun-2007, 01:46 PM

Testers

Dimmy
Posts: 2,001

Я не говорю по-русски 私は日本語を話さない

WWW
Hello bs nice to see you back here, how is it at home? all good with the baby? an being a dad? I will be dad for the 2nd time soon (the end date was today so it can happen any day now)

back to PHx, could PHx just place the placeholder back if no phx additions are found on the placeholder? so if there is no :anyphxthing= in the placeholder do not touch it.

I use PHx alot but I also use eForm alot and even togetter like this:
Code:
[+betalingsmethode:is=`Ideal`:then=` [!eForm? &eFormOnBeforeMailSent=`eForm2db` &allowhtml=`1` &formid=`kassaform` &to=`[+email+]`&from=`website@website.com` &fromname=`MiN Website` &bcc=`website@website.com` &replyto=`website@website.com `&tpl=`kassaform` &language=`nederlands`&report=`kassareport` &thankyou=`idealsubmit` &subject=`Bestelling vanaf de MiN site`!] [!order_sessie!]`:else=`[!eForm? &eFormOnBeforeMailSent=`eForm2db` &allowhtml=`1` &formid=`kassaform` &to=`[+email+]`&from=`dimitri@1-vision.nl` &fromname=`MiN Website` &bcc=`website@website.com` &replyto=`website@website.com`&tpl=`kassaform` &language=`nederlands`&report=`kassareport` &gotoid=`60` &subject=`Bestelling vanaf de MiN site`!] [!order_sessie!]`+]

mm thinking of the above code does leave the placeholders in place but the next call is stripped of the tags

Code:
[!eForm? &debug=`1` &formid=`persfriendform` &to=`[+uwemail+]`&bcc=`[+email+]` &from=`[+uwemail+]` &replyto=`[+uwemail+]` &tpl=`persfriendform` &language=`nederlands` &report=`persfriendreport` &thankyou=`vriendverstuurd` &subject=`[+naam+] wil graag dat u even kijkt...`!]
« Last Edit: 29-Jun-2007, 02:37 PM by Dimmy »

#145: 29-Jun-2007, 02:30 PM

Moderator

bS
Posts: 398

WWW
it should leave the unresolved ones intact (if they have NO modifiers). The ones with modifiers that are unresolved are cleared by PHx the ones without it just leaves for MODx. It's been a while since i write the code but I know i have spent many nights solving the parser problems. Maybe it's time for a short review later this week to help you guys out Smiley
Armand Pondman
MODx Coding Team
:: Jot :: PHx

#146: 2-Jul-2007, 08:18 PM

apatkar
Posts: 9

I have a problem wth phx. I am using an expression like :
[+phx:if=`[+placeholder+]`:ne=``:then=`[+placeholder+]`:else=``+]
The problem is that if the string which replaces placeholder is above 8600 or so characters, i get the entire phx statement in the output with the placeholder being replaced both times.

How can i fix or work around this?

#147: 3-Jul-2007, 06:02 AM

Moderator

bS
Posts: 398

WWW
can you send me the complete output so i can reproduce?
Armand Pondman
MODx Coding Team
:: Jot :: PHx

#148: 3-Jul-2007, 03:17 PM

apatkar
Posts: 9

Okay, the output looks like this test page I made:
http://cehd.gmu.edu/test5/

I have uploaded my chunk and snippet -
This is the chunk: http://www.box.net/shared/rf8br7luup
This is the snippet: http://www.box.net/shared/2tt54lbgdn

The call to the snippet is a non-cacheable call [!snippet!] and caching for the page where call is implemented is turned off too.

The number on the test page is the length of characters of the string which replaces placeholder, which i have found by trial and error to be the treshold in my case (16615). Strangely, it also seems to depend on the size of my chunk, because if I reduce the size of any string in my chunk, it seems to work as expected. It doesnt depend on the placeholder though ([+this+] is as good as [+placeholder+]). The length of the chunk without the placeholder is 108 characters.

There is one more weirder problem -

If chunk is like this (in one line):

[+phx:if=`[+placeholder+]`:ne=``:then=`<div id="publications"><h2>Recent Publications He</h2><div>[+placeholder+]</div></div>`:else=`PE`+]

then i get a blank page as output.

But if chunk is like this (a newline after <\div> with two characters removed from the header to compensate for \n and maintain limit threshold):

[+phx:if=`[+placeholder+]`:ne=``:then=`<div id="publications"><h2>Recent Publications </h2><div>[+placeholder+]</div>
</div>`:else=`PE`+]

then i get the "[+phx...." in the output with both instances of [+placeholder+] replaced.

#149: 4-Jul-2007, 09:46 PM


MEGU
Posts: 890

WWW
Dear all,
and I thank to your great work, PHx.

I have two troubles by Jot and PHx.
One contributed to the forum of jot.
Please refer to it:
http://modxcms.com/forums/index.php/topic,12828.msg103702.html#msg103702

But when I found another problem, it seems that it is trouble of PHx, I think.
So I contribute this forum.

About version:
 MODx 0.9.5
 PHx 2.1.2
 Jot 1.1.2

I tried the following:
1. create a chunk, for example.  Name is "forluluminitest".
Code:
[[Jot? &docid=`287` &validate=`content:content required,title:title requred:#[abc]#`]]

2. create a template and write as following.
Code:
......
{{forluluminitest}}
[+jot.html.comments+]
[+jot.html.navigation+]
[+jot.html.form+]
......

3. create a document and select the template which created in the above.  And save.
4. access url of document which create in the above.
5. comment form appears.
6. input the required fields.  And click button of "submit".
7. Then I get an error as following.
Code:
  Error: preg_match() [function.preg-match]: Empty regular expression
  Error type/ Nr.: Warning - 2
  File: /home/example/www/assets/snippets/jot/jot.class.inc.php
  Line: 781
  Line 781 source: if (!preg_match($re,$value))

NEXT:
1. Disable PHx.
2. Try again.
3. I do not get error.  The contribution of comment is successful.

NEXT:
1. Run PHx.
2. rewrite the chunk as following.
Code:
[[Jot?  &docid=`287` &validate=`content:content required,title:title requred:#abc#`]]
(Of course, the meaning of Regular expression would differ).

3. Try again.
4. I do not get error.

I would like to use Regular expression (for example, #[abc]#) in Jot.
But it is disabled, if PHx is able.

Can I solve this problem?

Sincerely yours,
« Last Edit: 4-Jul-2007, 10:28 PM by MEGU »

#150: 5-Jul-2007, 10:38 AM

Coding Team
netProphET
Posts: 478

Time is Art

WWW
Hi,
PHx is prohibiting me from specifying a Chunk name with a TV.
ex. {{[*right-hand-images*]}}
I have looked through this thread, and while it feels similar to the problem people are having specifying an address in the eForm snippet, I tried TobyL's mod http://modxcms.com/forums/index.php/topic,14306.msg96738.html#msg96738, and it did not do the trick.
Is this being worked on, or has been solved elsewhere?
Kind regards,
Mike

#151: 6-Jul-2007, 03:24 AM


MEGU
Posts: 890

WWW
> Dear netProphET

Thank you for answering my comment.
Quote
I tried TobyL's mod http://modxcms.com/forums/index.php/topic,14306.msg96738.html#msg96738,
and it did not do the trick.

I thank that you gived me valuable information.
I readed the thread which you showed.
I think also that my trouble is the same as that.

I tried TobyL's hack too.
But it did not work for me..

Sincerely yours,

#152: 13-Jul-2007, 06:29 AM

Testers
ncrossland
Posts: 241

FYI: using the hack will result in  PHX not being recursive.
The reason phx takes on the placeholders is because it needs to resolve the value when they are nested.


I haven't incorporated this hack for this reason. BUT I've uploaded a new version (2.1.3) which includes the "get modifier from file" functionality.
Author: ManagerManager plugin - customise your ModX manager interface

#153: 16-Jul-2007, 04:18 PM

Coding Team
netProphET
Posts: 478

Time is Art

WWW
PHx is prohibiting me from specifying a Chunk name with a TV.
ex. {{[*right-hand-images*]}}

It seems to me that 2 problems have surfaced for users of PHx
- using placeholders as snippet parameters
- using a template variable as the name of a Chunk

I would love to see a list of any other similar issues. It feels like there might be others. Are these issues being addressed or do they underscore an incompatibility - in order for PHx to achieve what it does, it makes certain feats of the core MODx parser impossible? If the former is true, I think there should be some sort of official disclaimer within the PHx distribution. Maybe with the rewrite of the core for 0.9.7, this will all go away, so expending energy on it for 0.9.6 is not worthwhile?

Any thoughts on this are appreciated.

#154: 20-Jul-2007, 08:32 AM

myan24
Posts: 122

I love MODx!

Hi,

When using ditto I'm trying to display a ditto template if the user is logged in and another if a user isn't logged in. The purpose being that only registered users can view the full document. Here's what I have which seems to work, but I wondered if anyone who has more experience could tell me if this is the best way to do it and if i've done it right:

Code:
[+phx:userinfo=`id`:gt=`0`:then=`
<h3>[+pagetitle+]</h3>
<p>[+introtext+]</p>
<p><a href="[~[+id+]~]">View details</a></p>
`:else=`
<h3>[+pagetitle+]</h3>
<p>[+introtext+]</p>
<p><a href="[~36~]">Login to view details</a></p>
`:strip+]

Document id 36 is a login page.

Thanks for any input!!

#155: 27-Jul-2007, 08:46 PM

Coding Team

pixelchutes
Posts: 889

WWW
Is it possible to leverage Ditto's pagination placeholders when PHx is enabled? Yes!

I am using v2.1.3, and PHx gets to my placeholders before Ditto even has a chance Sad

Sadly, http://ditto.modxcms.com/tutorials/phx-and-nested-tags.html doesn't account for "non-PHx nested placeholders"...

ditto_pages Chunk:
Code:
<div id="ditto_wrapper">
    <div id="ditto_pages">[+articles_previous+] [+articles_pages+] [+articles_next+]</div>
    <strong>[+articles_total+]</strong> Total Articles<br/>
</div>

Update:

The only work-around I was able to get to work was to actually place the chunk & placeholders inside of a snippet:

Code:
<?php
$html
='<div id="ditto_wrapper">
    <div id="ditto_pages">[+articles_previous+] [+articles_pages+] [+articles_next+]</div>
    <strong>[+articles_total+]</strong> Total Articles<br/>
</div>'
;

return 
$html;
?>


So, rather than having to store HTML in the snippet, I am going to rewrite it to pull from the chunk I was using before anyway:

Code:
<?php
return $modx->getChunk'ditto_pages' );
?>


And that worked! Cool

Now I can keep my code separate, and edit the chunk as I would normally, and PHx behaves nicely with my Ditto placeholders Smiley
« Last Edit: 27-Jul-2007, 09:07 PM by pixelchutes »
Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.

#156: 27-Jul-2007, 10:24 PM

Coding Team
netProphET
Posts: 478

Time is Art

WWW
Interesting, Pixelchutes. I used the same kind of solution to solve my problem, which had nothing to do with Ditto.
Problem: with PHx, I became unable to specify a Chunk directly with a TV, like this:
Code:
{{[*right-hand-images*]}}

Solution: so I wrote a snippet whose job it is to simply return a chunk, essentially like your snippet code. Then, to duplicate the functionality of the call above, I just need to change the call to this:
Code:
[[returnChunk? &chunk=`[*right-hand-images*]`]]

This might be the basic pattern to solving this general problem introduced by PHx.

#157: 29-Jul-2007, 12:59 PM

Coding Team

pixelchutes
Posts: 889

WWW

This might be the basic pattern to solving this general problem introduced by PHx.


What if PHx used different identifiers (or was able to be custom defined) other than [+ and +]? It would seem anything that NEEDED PHx modifiers/functionality could leverage PHx parser's identifiers, while regular placeholders used the MODx default ones?

I know this would solve at least 3 issues I have personally ran into, which involve Ditto, eForm, and your chunk example above...
Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.

#158: 29-Jul-2007, 05:50 PM

Foundation

rthrash
Posts: 11,353

WWW
Great point Mike. Sounds like a good consideration for a future release.
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#159: 7-Nov-2007, 10:35 AM

Coding Team
netProphET
Posts: 478

Time is Art

WWW
This is a vote for adding 2 core extenders to PHx.
- urlencode
- stripslashes
I have made my own extender mini-snippets to provide this functionality. They work fine, but they're just one simple php function, and I'm left thinking that if they were part of the PHx core code, there would be less processing going on.
I am using these functions a lot during form processing (along with the already-defined htmlent processor)... I am able to cut a lot of processing code out of my form handling snippets by moving these processors into the template.
May this also be considered as PHx functionality is integrated into the 0.9.7 core.

#160: 20-Dec-2007, 06:01 AM

boblin
Posts: 42

How to avoid cases where i have to use snippet with parameters inside Phx call? The only way i found is to create chunk with such call, but it is against good programing practices imho (-;
Pages: 1 ... 6 7 [8] 9 10 11   Go Up
0 Members and 1 Guest are viewing this topic.