TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

If and else problem

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: 4m0ni4c
Date: 2012-12-20
Time: 14:10

If and else problem

Hello, I just start using TBS and I have a problem with the condition if and else.

I'm also using cakePhp for the data.

In my .docx document, I have write this line:

[tests.Test.use;if[tests.Test.use]=='1';then’Use’;else‘Not use’;]

And my data is like that:

(int) 0 => array(
        'Test' => array(
            'id' => '10',
            'title' => 'wefwef',
            'use' => false,
            'valid' => true
But, when I generate my .docx, instead of get 'Use' or 'Not use' I get '1' which is the value of my 'tests.Test.use' variable which is a boolean variable.

So I would like to know how I can do to write 'Use' or 'Not use' ?

By: Skrol29
Date: 2012-12-20
Time: 23:43

Re: If and else problem

Your TBS field should be:
[tests.Test.use;if [val]=='1';then "Use";else "Not use"]

You have to place a space after parameter's names.

Solution also posted in: