Categories > TinyButStrong general >

Conditional in templates

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: testebr
Date: 2006-05-01
Time: 16:50

Conditional in templates

I wrote this:

<span><a href="javascript: ajax('recicle');"><img src="images/recicle_bin_full.jpg" alt="" width="30" height="37" border="0"></a> [onload_1;block=span;when [var.xonga]!=0]</span>

<span><a href="javascript: ajax('recicle');"><img src="images/recicle_bin_empty.jpg" alt="" width="30" height="37" border="0"></a> [onload_1;block=span;when [var.xonga]=0]</span>

This my code is coherent? Exists an better solution?

And its possible use only in img tag?
By: Skrol29
Date: 2006-05-01
Time: 19:55

Re: Conditional in templates

Hello,

This snippet is coherent.
You could use parameter "default" instead of "when" for the last block.

If your real conditional display is that simple, you could also do it like this:
<span>
  <a href="javascript: ajax('recicle');">
    <img src="images/recicle_bin_[var.xonga;if [val]=0;then 'empty'; else 'full'].jpg"
      alt="" width="30" height="37" border="0">
  </a>
</span>