We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27305
    • 173 Posts
    I’ve read the phx wiki but can’t get my head around it, I’m trying on my main template to say

    If this tv ([*role*] is empty then don’t show anything, else show this tv


    [+phx:if=`[*role*]`:is=``:then=`nothing`:else=`[*role*]`+]


    Can anyone shed some light on this for a code muppet like myself

    cheers

    ss
      I made my first site with modx
      ------------------------
      Shopping blog
      Sky+ HD
      • 11975
      • 2,542 Posts
      Hi,

      the code looks good to me
      A shorter syntax would be:
      [*role:isnot=``:then=`[*role*]`:else=`nothing`*]

      But first you have to check that no widget is applied to the tv.

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 27305
        • 173 Posts
        Thanks for the help, I used this, seems to work, in fact I’m re-thinking my templates, using conditions I should be able to cut down on the number of templates to use

             [*role:is=``:then=` `:else=`
        <h5>[*role*]</h5>`*]
          I made my first site with modx
          ------------------------
          Shopping blog
          Sky+ HD
          • 33982 ☆ A M B ☆
          • 476 Posts
          Thanks for the help, I used this, seems to work, in fact I’m re-thinking my templates, using conditions I should be able to cut down on the number of templates to use
          Yeh, using PHx helps me reduce the number of templates I have to set up by just making conditions...I don’t know a lick of PHP and PHx seems to be a great primer for PHP in understanding simple conditional statements. I use PHx pretty extensively.
            Precision Web Development ... SmashStack.com