We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22673
    • 72 Posts
    Hi guys,

    This is the first time I have tried using the if conditional in PHx. I am using the following peice of code inside a Ditto tpl chunk:

    [+phx:if=`[*tvSiteStatus*]`:is=`Amber`:then=`{{amber}}`:else=`{{red}}`+]


    The problem is that the ELSE chunk is always being pulled out even though "tvSiteStatus" is set to "Amber" in one of the resources.

    "tvSiteStatus" is a dropdown list with the values: "Amber||Red" and nothing else set (like the widget.)

    Any help would be much appreciated.
      • 26931
      • 2,314 Posts
      Hi paramaniac,

      guess you need to add &hiddenFields=`tvSiteStatus` to your Ditto call
      -> http://ditto.modxcms.com/tutorials/phx-and-nested-tags.html
        • 22673
        • 72 Posts
        Hi sharkbait, that seems to work.

        I also changed the tv name in the phx parameters from: [*tvSiteStatus*] to [+tvSiteStatus+]

        Thanks a lot!