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

    Hope someone can help with this.

    I have this in my template

    <h2>[*introtext*]</h2>

    But sometimes there will be no introtext, so I’m getting an empty <h2> tag.

    Is there a way of putting the <h2> as start/end tags, or making them only show if introtext has content?

    Thanks for your help, I’m very new to modx, so not up on the right terminology yet. smiley

      • 11076
      • 159 Posts
      from the Tag syntax i understand you’re using modx evolution,

      you can try using phx ( http://modxcms.com/extras/package/?package=342 )
      not sure but i guess you can use it like this and it should work fine:

      [*introtext:isnot=``:then=`<h2>[*introtext*]</h2>`*]
      or

      [+phx:if=`[*introtext*]`:is=``:then=``:else=`<h2>[*introtext*]</h2>`+]
      or

      [+phx:if=`[*introtext*]`:ne=``:then=`<h2>[*introtext*]</h2>`+]

      hope it helped smiley
        Michael Shraibman( gOmp)  | Freelance Design & Development | wink  impossible is nothing...