2016-08-05 84 views
-1

這是怎麼可能的?Smarty if - if語句中的鏈接變量

這是不是一個問題:

{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語句

回答

0

我自己找到了解決方案。

「貓」 可以解決這個問題:

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