Categories > Your tips & tricks >

Conditional display when variable exists or not

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Sebastian
Date: 2008-07-25
Time: 08:03

Conditional display when variable exists or not

Hallo,

I'm a bit confused with a template. I want to show a part of a template when a variable is given and an other part if the template if the variable does not exist. How can I do that?

If
$form['COUNTRY_IDENT']
is not set than I need to show the country selector.
      <li class="InputText">[var.form.COUNTRY_IDENT;magnet=li;when [val]='';noerr]
        <label for="COUNTRY" class=""><span><font>country:</font></span></label>
        <select name="COUNTRY" id="COUNTRY">
          <option value="[countries.PRIM_ID;block=option]">[countries.IDENT_ISO] ([countries.IDENT])</option>
        </select>
      </li>

If
$form['COUNTRY_IDENT']
is set than I want to show the value and image etc.
      <li class="Text">
        <label class=""><span><font>country:</font></span></label>
        [var.form.COUNTRY_IDENT;when [val]!='';noerr]<IMG src="images/Flags/smal/F_[var.form.COUNTRY_IDENT].gif" align="absmiddle" width="30" height="20" hspace="6">
          <INPUT type="hidden" name="COUNTRY" value="[var.form.COUNTRY_IDENT]">
      </li>

Why does this not work?

regards
Sebastian
By: Sebastian
Date: 2008-07-25
Time: 08:13

Re: Conditional display when variable exists or not

I think "Your tips & tricks" is not the right place for this post. Sorry I was a bit to fast with posting! Now I postet the same question in "Programming with TBS"
(http://www.tinybutstrong.com/forum.php?msg_id=9141#)

Sorry for double post!

Please reply to the post in "Programming with TBS"!

regards
Sebastian