previous<SELECT NAME="name"> (Previous) (Next) flexy:foreach="variable,key,value"next

View this page in Last updated: Sun, 21 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

flexy:if="variable or method()"

flexy:if="variable or method()" – PHP の if 条件タグを作成する

Synopsis

使用法 ( flexy:if="variable" , flexy:if="method()" , flexy:if="object.method()" )

Description

含まれるタグを囲む if 条件を作成します。

Parameter

  • string variable - $object->variable に関連します。

  • string method - $object->method() に関連します。

  • string object.method $object->object->method() に関連します。

Example

foreach 用の変数の設定

         
class output {
    function hasTest() {
        return false;
    }
    
    function run() {
        $this->a = true;
        $this->message = 'oops'
        $template->outputObject($this);
    }
}

テンプレートにおける flexy:if

   

<a href="{baseURL}/somepath.html" flexy:if="a">this is the a link</a>
<a href="{baseURL}/somepath.html" flexy:if="!a">this is not the a link</a>
<b flexy:if="hasTest()">hasTest is true</b>
<b flexy:if="!hasTest()">hasTest is false</b>

<span flexy:if="message" class="error">{message}</span>

コンパイルされたテンプレート

         
       
 
<?php if ($t->a)  { ?><A HREF="<?php echo htmlspecialchars($t->baseURL); ?>/somepath.html">this is the a link</A><?php } ?>
<?php if (!$t->a)  { ?><A HREF="<?php echo htmlspecialchars($t->baseURL); ?>/somepath.html">this is not the a link</A><?php } ?>
<?php if (isset($t) && method_exists($t,'hasTest')) if ($t->hasTest()) {  ?><B>hasTest is true</B><?php } ?>
<?php if (isset($t) && method_exists($t,'hasTest')) if (!$t->hasTest()) {  ?><B>hasTest is false</B><?php } ?>
 
<?php if ($t->message)  { ?><SPAN CLASS="error"><?php echo htmlspecialchars($t->message); ?></SPAN><?php } ?>

シンプルな出力例

         
      
this is the a link
hasTest is false

oops
previous<SELECT NAME="name"> (Previous) (Next) flexy:foreach="variable,key,value"next

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.