Categories > TinyButStrong general >

Display image / conditional display

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: http
Date: 2009-12-02
Time: 15:05

Display image / conditional display

Hey folks,

I've got a problem displaying an image depending on a a variable / block

well anyways heres my code:

<tr>
            <td>[user.#]</td>
            <td>[user.username;block=tr]</td>
            <td>[user.email]</td>
            <td>[user.usergroup]</td>
            <td><span>[user.active;block=span;when[user.active]=1]<img src="../templates/img/icons/tick.png" alt=""></span></td>
            <td>[user.id]</td>
            <td></td>
        </tr>

As you can see a simple listing of users. But now it shows me the tick.png and the number regardless of its value.
So if user.active is 0 it shows me zero and tick.png.

What i really want is, that I don't see the number at all just the tick.

If somebody could help me that would be really nice

so long
By: Skrol29
Date: 2009-12-02
Time: 15:55

Re: Display image / conditional display

You should not define a block section inside a block with the same name.
What you need is parameter magnet to show or hide the <span>.

<td><span>[user.active;magnet=span;when [val]=1;then ' ';else '' ]<img src="../templates/img/icons/tick.png" alt=""></span></td>
By: http
Date: 2009-12-02
Time: 16:11

Re: Display image / conditional display

Thanks for helping me Skrol29 but:
if I use:
<span>[user.active;magnet=span;when [val]=1;then '';else '' ]<img src="../templates/img/icons/tick.png" alt=""></span>

it still outputs me the tick.png aswell as user.active.. which it shouldn't..

I'm going to read a little about magnets.. didn't had to use them till now so I knew they exist but didn't know what they do or how they work..
By: Skrol29
Date: 2009-12-02
Time: 17:01

Re: Display image / conditional display

replace "when" with "if"
By: http
Date: 2009-12-02
Time: 19:04

Re: Display image / conditional display

thanks a lot Skrol29