Smarty if - 在if语句中链接变量

时间:2016-08-05 10:25:56

标签: php html smarty

这怎么可能?

这不是问题:

{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.start使用" pipe"和另一个变量$date.today.end

{$date.today.start}|{$date.today.end}
在IF声明中

1 个答案:

答案 0 :(得分:0)

我自己找到了解决方案。

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

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