Categories > TinyButStrong general >

Problem with condition

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: raven22k
Date: 2011-11-30
Time: 14:43

Problem with condition

Hello,

i´m new on TBS and i have a problem with conditions. Thats code i have problems with:
<div>[onload;script=[var.mode]/[var.mode].php;subtpl;getbody;if [var.mode]!=0]</div>
<div>[onload;file='tpl/error_mode.html';getbody;if [var.mode]=0]</div>

Whatever the value of mode is both [onload] scripts will be executed.In fact i want that the first [onload] will be executed when "mode" is not 0 and the second [onload] when mode is 0, but this doenst work and i dont know why. the value of [var.mode] is right.

I hope somebody can help me :)

with regards

raven22k
By: Skrol29
Date: 2011-11-30
Time: 16:14

Re: Problem with condition

Hi,

The goal of parameter "if" is only to change the value of the current field being merged.
But both parameters "file" and "script" do nothing without error when the script name is an empty string.

So the following should work:
<div>
  [onload.mode;script;subtpl;getbody;if 0='[val]';then ''; else '[val]/[val].php']
  [onload.mode;file;getbody;if 0='[val]';then 'tpl/error_mode.html'; else '']
</div>
By: raven22k
Date: 2011-11-30
Time: 17:05

Re: Problem with condition

thx alot,

this works fine!