Categories > OpenTBS general >

Multi-conditional

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: andeve
Date: 2014-04-22
Time: 16:29

Multi-conditional

Hi,

I'm try to do multi-conditional with openTBS.

I have a .docx file which contains tbs:rows blocks with my content. I want to display some of these blocks according to an integer variable.

Here, an example of my .docx file
---------------------------------------------
John Doe [onshow;block=tbs:row;when [myvar]=1;when [myvar]=2]         // row 1
---------------------------------------------
Obiwan Kenobi [onshow;block=tbs:row;when [myvar]=3;when [myvar]=4]    // row 2
---------------------------------------------

I would like to display the 1st row when my variable equals to 1 OR 2, otherwise, then second one.

After some tests, i can say that when the true condition is the first one, my block isn't displayed. When then second condition is true, i got it.

Does anyone has some ideas ?

PS : sorry for my english ;)
By: Skrol29
Date: 2014-04-23
Time: 22:31

Re: Multi-conditional

Hi,

There is no smart way to do an OR in a TBS expression at the template size. Complicated expressions are for the PHO side.
You have to prepare another PHP variable that contains the reference of the row t display. An then use a simple "when [myvar]=X" on each row.
By: andeve
Date: 2014-04-24
Time: 09:47

Re: Multi-conditional

Thx for your answer. I'll do that.
But I'm pretty sure that it could be an interesting thing to add to TBS.
By: Skrol29
Date: 2014-04-24
Time: 14:55

Re: Multi-conditional

> But I'm pretty sure that it could be an interesting thing to add to TBS.

The problem is the more we will allow possibilities in  expression at the template side, the more you'll need other possibilities (OR,XOR, lower, upper, ...) and the more you are inserting coding at the template side.