Categories > TinyButStrong general >

Field with if

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Gustaf
Date: 2006-05-05
Time: 17:49

Field with if

Hello.
If I have a variable $is_admin on the php-side and following code on html-side
[var.is_admin;if [val]==1; then '
Admin
']
then if $is_admin != 1 the value of $is_admin will be printed.

I can solve this by
[var.is_admin;if [val]==1; then '
Admin
'; else '']
but I don't want to.

How can I avoid this "the right way"?
I'm using the latest TBS-version

Thanks...
By: Skrol29
Date: 2006-05-05
Time: 18:25

Re: Field with if

> I can solve this by [...] but I don't want to.

Why not ?

You can also do:
[onshow;if [var.is_admin]=1;then 'Admin']

Or:
<span>Admin[onshow;if [var.is_admin]=1;then ' ';bmagnet=span]</span>
By: Gustaf
Date: 2006-05-05
Time: 23:13

Re: Field with if

>> I can solve this by [...] but I don't want to.

>Why not ?

[var.is_admin;if [val]==1; then '
Admin
'; else '']
has an unnecessary else condition that i don't use. That's why.
Thanks for your reply.
I've used TBS for a year now and i like it more and more. TBS 3.0 seems to be great.
By: Skrol29
Date: 2006-05-08
Time: 23:03

Re: Field with if

> has an unnecessary else condition that i don't use

The "else" was unecessary in TBS 2.x for unlogical reason.
Now it is more logical (but less beautiful) to code.