We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28513
    • 53 Posts
    I’m using backticks
      • 26931
      • 2,314 Posts
      [+phx:if=`[+workFull2+]`:gt=`10`:then=`<a href="[+workFull2+]" class="workLink" title="[+longtitle+]" rel="[+pagetitle+]">`:else=``+]

      i just tested this on one of my sites. if [+workFull2+] is empty, nothing will be displayed, if i fill in a URL, the whole link will be displayed ( i pasted it directly in the template, changing [+workFull2+] -> [*workFull2*] etc. )

      hope i could help smiley

      *edit: if the code is a normal chunk (and not a ditto-template chunk ), you probably need to call the TVs like this: [*workFull2*][*longtitle*]...
        • 28513
        • 53 Posts
        Awesome, that worked!

        So what is the greater than 10 referring to?

        Thanks so much for your help.
          • 26931
          • 2,314 Posts
          great! smiley
          So what is the greater than 10 referring to?
          is greater than (>)
          http://wiki.modxcms.com/index.php/PHx#gt
            • 28513
            • 53 Posts
            right, but what is the 10?
              • 26931
              • 2,314 Posts
              right, but what is the 10
              sorry, it should actually be ( note the :len after the TV name):
              [+phx:if=`[*yourtv:len*]`:gt=`10`:then=`[*yourtv*]`:else=``+]
              so if the string of "yourtv" is greater than 10 it will output the TV value

              for
              [+phx:if=`[*yourtv:len*]`:gt=`2`:then=`[*yourtv*]`:else=``+]
              it will show nothing if the value of the TV is for e.g. just one character

              http://wiki.modxcms.com/index.php/PHx#length_.7C_len