Categories > TinyButStrong general >

using when to compare a block and a field value

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Stefan
Date: 2006-11-28
Time: 14:02

using when to compare a block and a field value

I have a field variable [var.page] and a value in a block [menu.page]. The first is constant for one page, the second one comes from an array.

They are both displayed correct, individually, but when I want to compare them I get confused. I want to display a third field [var.currentpage] only when [var.page] equals [menu.page].

[var.currentpage;block=tr;when[var.page]=[menu.page]

Unfortunately, the var.currentpage is always displayed...
By: Stefan
Date: 2006-11-28
Time: 14:03

Re: using when to compare a block and a field value

By the way, the missing "]" in my code example is not missing in my real code...
By: Skrol29
Date: 2006-11-28
Time: 14:21

Re: using when to compare a block and a field value

"block=tr" is useless for a [var] field. It is ignored.
"when" is a parameter for block so it is also ignored in your [var] field.

A solution :
[var.currentpage; if [menu.page]!=[var.page];then '']

If the [menu.page] field should also define the "menu" block, it can be :
[var.currentpage; if [menu.page;block=tr]!=[var.page];then '']

Another way to do the same :
[menu.page;block=tr;if [val]=[var.page];then [var.currentpage]; else '']