Categories > TinyButStrong general >

conditional block

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: joris
Date: 2007-11-14
Time: 15:07

conditional block

This is a block in my template
var.count equals 9

[onshow;if [var.count]>7; then '<div style="text-align:center;width:615px;margin-bottom:11px;margin-top:11px;"><img src="" width="468" height="60" alt="Grote banner (468x60)"></div>'; else '';]

but strangly it shows no image.

when I use this:
[onshow;if [var.count]=9; then '<div style="text-align:center;width:615px;margin-bottom:11px;margin-top:11px;"><img src="" width="468" height="60" alt="Grote banner (468x60)"></div>'; else '';]

then it DOES show the banner.

Isn't it possible to check if a value is greater then 7? I can't figure it out.

Thank you
By: TomH
Date: 2007-11-15
Time: 04:24

Re: conditional block

I found this summary in the Manual at http://www.tinybutstrong.com/manual.php#html_field_prm_if
if expr1=expr2      Display the data item only if the condition is verified, otherwise display nothing unless parameter then or else are used.
Supported operators are:
= or ==     equal
!=     not equal
+-     greater than
+=-     greater than or equal to
-+     less than
-=+     less than or equal to
~=     match the regular expression (since TBS version 3.0)
Both expr1 and expr2 must be string or numerical expressions.
You can use the keyword [val] inside the expression to insert the current data item.
You can use [var] fields inside the expression.
The expressions may contain other TBS fields, but you have to make sure that they are merged before the containing field.
Since TBS version 3.0, it is also possible to define several couples of if/then in the same field.
See parameters then and else for some examples.
Hope that helps ;)
By: joris
Date: 2007-11-15
Time: 09:12

Re: conditional block

You are a life saver :)

That worked like a charm!