We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36931
    • 206 Posts
    Hello,

    In one of my page (admin side) I created a template variable. This template varaible display a check box. You can select yes or no.

    In my template, I would like to display an information depending of the yes or the no.

    I just fond this

    [[*background:modifier=`0`]]

    But how can I modify if to

    if [[*background:modifier=`0`]] then display "blue"
    else if [[*background:modifier=`1`]] then display "Orange"

    Or should I better use ifEval paquage?

    Thank
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You would do better to make radio buttons, one for blue and one for orange.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 34084 ☆ A M B ☆
        • 756 Posts
        If you were using it inside a class of a div for example it may look like:

        <div class="[[*background:eq=`0`:or:eq=``:then=`blue`:else=`orange`]]">....</div>


        In this case it's doing the following:

        1. if value of tv background is equal to zero or empty (not set) then render text blue
        2. else render text orange
          Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
          Visit CharlesMx.com for latest news and status updates.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          It's a matter of design philosophy. The output modifiers are very resource-intensive, and it's always a better idea to avoid them altogether if possible. A radio button TV with the two options would do just that.

          Just have this in your Input Options for the TV, and have the most commonly used value as the default value.
          Orange==orange||Blue==blue
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org