本文介绍了如何在if条件下使用多个操作数(ModX)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为ModX使用if-extra。是否可以使用mutliple操作数,这意味着以更短的方式编写此代码:
I am using the if-extra for ModX. Is it possible to use mutliple operands, meaning write this code in a shorter way:
[[!If?
&subject=`[[!getUrlParam? &name=`id`]]`
&operator=`EQ`
&operand=`1`
&then=`do something`
]]
[[!If?
&subject=`[[!getUrlParam? &name=`id`]]`
&operator=`EQ`
&operand=`2`
&then=`do something`
]]
[[!If?
&subject=`[[!getUrlParam? &name=`id`]]`
&operator=`EQ`
&operand=`3`
&then=`do something`
]]
无法找到办法。
推荐答案
我可以使用这个解决方案:
I could work with this solution:
[[If?
&subject=`[[!getUrlParam? &name=`id`]]`
&operator=`inarray`
&operand=`1,2,3`
&then=`do something`
]]
这篇关于如何在if条件下使用多个操作数(ModX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!