ユーザ用ツール

サイト用ツール


web:modx:revolution:addons:if

if

chunkやコンテンツ中で簡易な制御を可能にするスニペット。

USAGE

[[!if]]

パラメータ

NameDescriptionDefault Value
subjectThe value to perform the conditional on.
operatorThe operator to compare the subject against.=
operandIf needed, the value to compare the subject against using the operator.
thenIf the condition is true, output this.
elseIf the condition is false, output this.
debugTRUE(1)をセットすると渡されたプロパティを表示0
dieIf debug and this is true, die() after printing the properties.0
operator
!=,neq,not,isnot,isnt,unequal,notequalPasses if the subject is unequal to the operand.
==,=,eq,is,equal,equals,equaltoPasses if the subject is equal to the operand.
<,lt,less,lessthanPasses if the subject is less than the operand.
>,gt,greater,greaterthanPasses if the subject is greater than the operand.
<=,lte,lessthanequals,lessthanorequaltoPasses if the subject is less than or equal to the operand.
>=,gte,greaterthanequals,greaterthanequaltoPasses if the subject is greater than or equal to the operand.
isempty,emptyPasses if the subject is empty.
!empty,notempty,isnotemptyPasses if the subject is not empty.
isnull,nullPasses if the subject is null.
inarray,in_array,iaPasses if the subject is found in the operand list. (comma-delimited string)

[[!If?
    &subject=`[[+gender]]`
    &operator=`equal`
    &operand=`male`
    &then=`Hello, Mr. [[+name]]!`
    &else=`Hello, Ms. [[+name]]!`
]]
[[!If?
    &gender=`[[+name]]`
    &operator=`notempty`
    &then=`Hello, [[+name]]!`
    &else=`Hello, anonymous!`
]]

参考

web/modx/revolution/addons/if.txt · 最終更新: 2017/04/14 05:21 by 127.0.0.1