smarty-php / smarty

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
Other
2.24k stars 705 forks source link

How to use '|' as '||'? #1041

Closed pmsl987 closed 2 months ago

pmsl987 commented 2 months ago

{if $a|$b } the code is can work in smarty2.1,but in smarty5.x has error: Unexpected "$b", expected one of: "id, name" , "@" There are a lot of similar codes in my project, I can't use '||' replace it.

wisskid commented 2 months ago

I'm afraid you can't. The | has a special meaning in Smarty. It activates a modifier. I think that it was unintentional that this worked in Smarty 2. But Smarty 3 is a long long time ago, so I can't really be sure.