We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20575
    • 36 Posts
    Hi. I have set a template that has 5 TV’s for extra images, they all reference the page title for the alt tag. The problem arises when the TV is left blank on some pages it displays the alt text on the page. Is there anyway to write if statements that check if the TV is empty and if so will not display the image or hide the alt text?

    Many thanks in advance!
      • 14197
      • 35 Posts
        • 20575
        • 36 Posts
        Hi. I have installed PHx ok. I am trying to write an if statement to see if there is anything in a TV I have made call fabric-swatch-01, if this comes back as false I want to show a TV called placeholder which is just a 1px x 1px white image this gets around the problem of the alt text showing up when no image is in the TV.

        Here’s my attempt:

        [+phx:if=[+tvfabric-swatch-01+]:is=`1`:then=`[+fabric-swatch-01+]`:else=`[+tvplaceholder+]`+]


        This doesn’t work can anyone tell me why? Many thanks!
          • 33976 ☆ A M B ☆
          • 571 Posts
          Hello, i guess you should do:

          <img src="[+imgTv+]" [+phx:if=`[+imgTv+]`:ne=`alt="alt tag"`:else=``+] />


          Which would check if the placeholder "imgTv" is empty or not, if not empty > display alt="alt tag", else display nothing.
          I hope it’ll help you smiley

          Cheers
            • 7455
            • 2,204 Posts
            if you use an image tv and set the output widget to image then if there is no image selected the tv wil output noting not even the imagetags
              follow me on twitter: @dimmy01