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

    What is the best way to wrap HTML around commonly used template tags like: [[*id]], [[*pagetitle]], [[*longtitle]], [[*alias]], [[*description]], [[*introtext]],[[*parent]], [[*menutitle]], [[*content]]

    I want to avoid an output if a tag is empty. For example:

    If [[*longtitle]] is not empty:
    <h1>[[*longtitle]]</h1>


    Otherwise not output is generated. Not:
    <h1></h1>


    Best regards,
    loxy
      • 12110
      • 122 Posts
      Did you already look into Phx?

      http://modxcms.com/extras/package/?package=342

      If Phx is installed (plugin) then this should work:

      [*longtitle:ifempty=``:else=`<h1>[*longtitle*]</h1>`*]


      Did not test this right now but there’s a Wiki also.

        • 17552
        • 46 Posts
        The link doesn’t work. I coudn’t find such a plugin also.
        But the input and output filters should work in this manner!
        Or better, they are working definitely. I’ve testet it just now. Thanks!
          • 12110
          • 122 Posts
          The link is working for me, to the PHx Package site in repository
            • 27347
            • 65 Posts
            Quote from: loxy at Nov 18, 2010, 04:45 AM

            The link doesn’t work. I coudn’t find such a plugin also.
            But the input and output filters should work in this manner!
            Or better, they are working definitely. I’ve testet it just now. Thanks!

            Yeah, in Revo output filters is what you are looking for.

            [[*longtitle:notempty=`<h2>[[*longtitle]]</h2>`]]