web:modx:revolution:addons:if
if
chunkやコンテンツ中で簡易な制御を可能にするスニペット。
USAGE
[[!if]]
パラメータ
| Name | Description | Default Value |
|---|---|---|
| subject | The value to perform the conditional on. | |
| operator | The operator to compare the subject against. | = |
| operand | If needed, the value to compare the subject against using the operator. | |
| then | If the condition is true, output this. | |
| else | If the condition is false, output this. | |
| debug | TRUE(1)をセットすると渡されたプロパティを表示 | 0 |
| die | If debug and this is true, die() after printing the properties. | 0 |
| operator | |
|---|---|
| !=,neq,not,isnot,isnt,unequal,notequal | Passes if the subject is unequal to the operand. |
| ==,=,eq,is,equal,equals,equalto | Passes if the subject is equal to the operand. |
| <,lt,less,lessthan | Passes if the subject is less than the operand. |
| >,gt,greater,greaterthan | Passes if the subject is greater than the operand. |
| <=,lte,lessthanequals,lessthanorequalto | Passes if the subject is less than or equal to the operand. |
| >=,gte,greaterthanequals,greaterthanequalto | Passes if the subject is greater than or equal to the operand. |
| isempty,empty | Passes if the subject is empty. |
| !empty,notempty,isnotempty | Passes if the subject is not empty. |
| isnull,null | Passes if the subject is null. |
| inarray,in_array,ia | Passes 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 · 最終更新: by 127.0.0.1
