聪明的if-在if语句中链接变量


Smarty if - chaining variables in if statement

这怎么可能?

这不是问题:

{if $date.today.start eq $filter.selected} selected="selected" {/if}

但我想知道这怎么可能?(if语句中的链接变量)

{if {$date.today.start}|{$date.today.end} eq $filter.selected} selected="selected" {/if}

这使我出现语法错误。

那么我怎么可能结合呢

带有"管道"和另一个变量$date.today.end:的$date.today.start

{$date.today.start}|{$date.today.end}

在IF声明中?

我自己找到了解决方案。

"猫"可以解决这个问题:

{if $date.today.start|cat:'|'|cat:$date.today.end eq $filter.selected} selected="selected" {/if}