We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9359
    • 128 Posts
    Hi everybody,
    i don't understand what happen....
    i have a snippet that count the child of a resource [!countChild!]. The output of [!countChild!] is 1, but...

    [+phx:if=`[!countChild!]`:is=`1`:then=`count child is 1 - write[!countChild!]` : or:is=`2`:then=`count child is 2 - write [!countChild!]` : or:is=`3`:then=`count child is 3 - write [!countChild!]`:else=``+]

    I call the PHx in page with 1 children and my output is count child is 3 - write 1 huh????
    How is it possible?


    [ed. note: fabryshock last edited this post 15 years ago.]
      "Destiny is not a matter of chance, it's a matter of choice"
      • 16278
      • 928 Posts
      Don't know, but why are you using PHx like this in the first place? If you want to include the output of a snippet, why not use the snippet on its own?

      PHx is "placeholders extended", it modifies the output of placeholders. It's quite easy to create your custom modifiers (using your own snippets) to extend the built-in PHx handling of placeholders, if you need more complex processing. And personally I find that method a lot easier than trying to understand the PHx syntax for anything beyond very simple expressions.

      ;) KP
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Indeed, an Evo "count child" snippet would be simple enough to just add the conditional code for the output to be whatever you want.
          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