previous$factory->setRequired() (Previous) (Next) {method(arguments,#quoted arguments#)}next

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

{variable}

{variable} – 変数を表示するための PHP コードを作成する

Synopsis

使用法 ( {variable} , {variable:h} , {variable:u} )

Description

変数を表示するための PHP コードを作成します。 オプションで修正子を指定できます。指定できる修正子は次のとおりです

  • 修正子なし - htmlspecialchars($variable) を行います

  • :h - なにも手を加えずに表示します

  • :u - urlencode($variable) を表示します

デフォルトでは、変数は呼び出し元のスコープにあるとみなされ、 先頭に $t-> がつきます。しかし、もしループ (foreach) 内に変数があるのなら、 ループで作成された変数はそのスコープに追加されるので先頭には何もつきません。

Example

オブジェクト変数の設定

         

$this->a = "hello >>";
$template->outputObject($this);

変数の出力

   
       
{a}
{a:h}
{a:u}

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

         
       
<?php echo htmlspecialchars($t->a); ?>
<?php echo  $t->a; ?>
<?php echo urlencode($t->a); ?>

シンプルな出力例

         
      
hello &gt;&gt;
hello >>
hello+%3E%3
previous$factory->setRequired() (Previous) (Next) {method(arguments,#quoted arguments#)}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.