Smarty 3: if, mixed conditions & operators

岁酱吖の 提交于 2019-12-25 05:08:38

问题


well... can you tell me why this works:

{if !$conta|contains:"word1" && ($product->id_category_default < 388 || $product->id_category_default > 475)}

and this not:

{if (!$conta|contains:"word1" || !$conta|contains:"word2") && ($product->id_category_default < 388 || $product->id_category_default > 475)}

where is the syntax error?


回答1:


Try this instead:

{if !($conta|contains:"word1" || $conta|contains:"word2") && ($product->id_category_default < 388 ||  $product->id_category_default > 475)}


来源:https://stackoverflow.com/questions/6717436/smarty-3-if-mixed-conditions-operators

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!