We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25560
    • 16 Posts
    Hi, I’m using Revolution (latest release).

    I’ve assigned a TV to my template, but in my template I wrap a div around it. with some margin/border etc.

    <div id="foo">
    [[*mytemplatevar]]
    </div>

    How can I adjust my TV to only show the wrapping DIV if the TV has been set?

    The TV is an image. presumably I would put it in a chunk with some input/output filtering? but i couldn’t see an "isset" type function.


    so in pseudo ~

    if(isset($myTV)) { 
     return '<div id="foo"> . $myTV . '</div';
    } else 
     // return nothing
    }
    thanks in advance.
    
      • 5340
      • 1,624 Posts
      For Revo you can use IF

      Adapt this code to be used with IF
        • 1778
        • 659 Posts
        Or you can use an output modifier
        [[!*myTV:is=``:then=``:else=`<div id='foo'>[[*myTV]]</div>` ]]
        


        Cheers
          • 25560
          • 16 Posts
          Quote from: cipa at Oct 07, 2010, 06:21 AM

          For Revo you can use IF

          Adapt this code to be used with IF

          hadn’t seen that, but that’s very useful, thank you

          Quote from: anso at Oct 07, 2010, 06:25 AM

          Or you can use an output modifier
          [[!*myTV:is=``:then=``:else=`<div id='foo'>[[*myTV]]</div>` ]]
          


          Cheers

          ahah, that’s also a nice way of doingit.

          cheers both
            • 33976 ☆ A M B ☆
            • 571 Posts
            Hello,

            one shorter way with output modifier would be
            [[*myTv:notempty=`<div>[[*myTv]]</div>`]]

            Those modifiers are really nice, aren’t they ? wink ( http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters )

            Cheers
              • 1778
              • 659 Posts
              Yep indeed very nice...

              BTW I gave an "extended" version in the case ross needed a "if else" routine wink
              cheers