<![CDATA[ PHX _ if... then - doesnt work - My Forums]]> https://forums.modx.com/thread/?thread=100437 <![CDATA[PHX _ if... then - doesnt work]]> https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542791 When I do not give a tag to a resource, then I see my empty CSS styling (for example a big red box where normally the tag title would show, but since I did not specify a tag it is just the red box). Now I created below PHX which basically should work like this... If there is NO title tag specified then show nothing (so NO red box).
I think my below code is correct, but I see nothing front-end. Even when I have tag titles.
I already tried replacing the * with +, but no success.


[+phx:if=`[*tag1*]`:ne=``:then=`
                <div class="tag">
                    <a class="clearfix show" href=
                    "/search?search=[*tag1*]">[*tag1*]</a>
                </div>`+] [+phx:if=`[*tag2*]`:ne=``:then=`
                <div class="tag">
                    <a class="clearfix show" href=
                    "/search?search=[*tag2*]">[*tag2*]</a>
                </div>`+] [+phx:if=`[*tag3*]`:ne=``:then=`
                <div class="tag">
                    <a class="clearfix show" href=
                    "/search?search=[*tag3*]">[*tag3*]</a>
                </div>`+]
]]>
basra101 Jun 24, 2016, 11:50 AM https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542791
<![CDATA[Re: PHX _ if... then - doesnt work]]> https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542815
Your reply#3 code worked.

Still dont understand why my original code and your reply#2 code didnt work (I dont use Ditto together with it), but thank you for your research and help! Problem solved... smiley]]>
basra101 Jun 24, 2016, 06:45 PM https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542815
<![CDATA[Re: PHX _ if... then - doesnt work]]> https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542814
If you are using PHX with Ditto you may experience some wierd results, they don't work well together

If you are using "IF" with ditto, you have to replace "*" with "+" in the "IF" call]]>
iusemodx Jun 24, 2016, 05:40 PM https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542814
<![CDATA[Re: PHX _ if... then - doesnt work (Best Answer)]]> https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542813 an example here that is pretty much the same as what you are trying to accomplish

Using IF:
[[if? &is=`[*tag1*]:not_empty` &then=`<div class="tag"><a class="clearfix show" href="/search?search=[*tag1*]">[*tag1*]</a></div>`]]
]]>
iusemodx Jun 24, 2016, 05:23 PM https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542813
<![CDATA[Re: PHX _ if... then - doesnt work]]> https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542812 PHX RTFM

My first code was wrong - but looking at your code, it should work, but give the following a try - its slightly different to yours - it says if the element is empty do nothing, otherwise do something
[+phx:if=`[*tag1*]`:is=``:then=``:else=`<div class="tag"><a class="clearfix show" href="/search?search=[*tag1*]">[*tag1*]</a></div>`+]


]]>
iusemodx Jun 24, 2016, 05:03 PM https://forums.modx.com/thread/100437/phx-if-then---doesnt-work#dis-post-542812