7-4 testモディファイア

156ページ

<mt:SetVar name="bar" value="10" />
 
<mt:if test="$bar > 5">
  <mt:GetVar name="bar" />
</mt:if>
<mt:SetVar name="foo" value="OK" />
 
<mt:if test="$foo =~ /\w+/">
  <mt:GetVar name="foo" />
</mt:if>

複合条件の判定

変更前

<mt:SetVar name="foo" value="10" />
<mt:SetVar name="bar" value="20" />
 
<mt:if name="foo" eq="10">
  <mt:if name="bar" eq="20">
OK
  </mt:if>
</mt:if>

変更後

<mt:SetVar name="foo" value="10" />
<mt:SetVar name="bar" value="20" />
 
<mt:if test="$foo eq '10' && $bar eq '20'">
OK
</mt:if>

変数の設定

<mt:if test="$foo='bar'; $foo eq 'bar'">
<mt:if test="$foo='foo'; $foo.='bar'; $foo =~ /foobar/">

このアーカイブについて

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。