File/class/Ethna_SmartyPlugin.php

Description

Ethna_SmartyPlugin.php

Functions
smarty_block_form (line 738)

smarty block:フォームタグ出力プラグイン

void smarty_block_form ( $params,  $content,  &$smarty,  &$repeat)
  • $params
  • $content
  • &$smarty
  • &$repeat
smarty_function_checkbox_list (line 516)

smarty function:チェックボックスフィルタ関数(配列対応)

  • deprecated:
void smarty_function_checkbox_list ( $params,  &$smarty, string $form, string $key, string $value)
  • string $form: チェックボックスに渡されたフォーム値
  • string $key: 評価対象の配列インデックス
  • string $value: 評価値
  • $params
  • &$smarty
smarty_function_csrfid (line 812)

smarty function: 正当なポストであることを保証するIDを出力する

sample:

  1.   {csrfid}
  1.   <input type="hidden" name="csrfid" value="a0f24f75e...e48864d3e">

  • see: isRequestValid
void smarty_function_csrfid ( $params,  &$smarty, string $type)
  • string $type: 表示タイプ("get" or "post"−デフォルト="post")
  • $params
  • &$smarty
smarty_function_form_input (line 674)

smarty function:フォームタグ生成

void smarty_function_form_input ( $params,  &$smarty, string $name)
  • string $name: フォーム項目名
  • $params
  • &$smarty
smarty_function_form_name (line 611)

smarty function:フォーム表示名生成

void smarty_function_form_name ( $params,  &$smarty, string $name)
  • string $name: フォーム項目名
  • $params
  • &$smarty
smarty_function_form_submit (line 657)

smarty function:フォームのsubmitボタン生成

void smarty_function_form_submit ( $params,  &$smarty, string $submit)
  • string $submit: フォーム項目名
  • $params
  • &$smarty
smarty_function_is_error (line 413)

smarty function:指定されたフォーム項目でエラーが発生しているかどうかを返す NOTE: {if is_error('name')} は Ethna_Util.php の is_error() であって、 smarty_function_is_error() ではないことに注意

void smarty_function_is_error ( $params,  &$smarty, string $name)
  • string $name: フォーム項目名
  • $params
  • &$smarty
smarty_function_message (line 434)

smarty function:指定されたフォーム項目に対応するエラーメッセージを出力する

sample:

  1.   <input type="text" name="foo">{message name="foo"}
  1.   <input type="text" name="foo">fooを入力してください

void smarty_function_message ( $params,  &$smarty, string $name)
  • string $name: フォーム項目名
  • $params
  • &$smarty
smarty_function_select (line 492)

smarty function:セレクトフィールド生成

  • deprecated:
void smarty_function_select ( $params,  &$smarty, array $list, string $name, string $value, string $empty)
  • array $list: 選択肢一覧
  • string $name: フォーム項目名
  • string $value: セレクトボックスに渡されたフォーム値
  • string $empty: 空エントリ(「---選択して下さい---」等)
  • $params
  • &$smarty
smarty_function_uniqid (line 471)

smarty function:ユニークIDを生成する(double postチェック用)

sample:

  1.   {uniqid}
  1.   <input type="hidden" name="uniqid" value="a0f24f75e...e48864d3e">

  • see: isDuplicatePost
void smarty_function_uniqid ( $params,  &$smarty, string $type)
  • string $type: 表示タイプ("get" or "post"−デフォルト="post")
  • $params
  • &$smarty
smarty_function_url (line 558)

smarty function:url生成

void smarty_function_url ( $params,  &$smarty)
  • $params
  • &$smarty
smarty_modifier_checkbox (line 332)

smarty modifier:チェックボックス用フィルタ

sample:

  1.   <input type="checkbox" name="test" {""|checkbox}>
  2.   <input type="checkbox" name="test" {"1"|checkbox}>
  1.   <input type="checkbox" name="test">
  2.   <input type="checkbox" name="test" checkbox>

string smarty_modifier_checkbox (string $string)
  • string $string: チェックボックスに渡されたフォーム値
smarty_modifier_count (line 83)

smarty modifier:count()

count()関数のwrapper

sample:

  1.   $smarty->assign("array"array(123));
  2.  
  3.   {$array|@count}
  1.   3

  • return: 配列の要素数
int smarty_modifier_count (array $array)
  • array $array: 対象となる配列
smarty_modifier_filter (line 142)

smarty modifier:filter()

指定された連想配列のうち$keyで指定された要素のみを配列に再構成する

sample:

  1.   $smarty->assign("array"array(
  2.       array("foo" => 1"bar" => 4),
  3.       array("foo" => 2"bar" => 5),
  4.       array("foo" => 3"bar" => 6),
  5.   ));
  6.  
  7.   {$array|@filter:"foo"|@join:","}
  1.   1,2,3

  • return: 再構成された配列
array smarty_modifier_filter (array $array, string $key)
  • array $array: filter対象となる配列
  • string $key: 抜き出して配列を構成する連想配列のキー
smarty_modifier_form_value (line 390)

smarty modifier:フォーム値出力フィルタ

フォーム名を変数で指定してフォーム値を取得したい場合に使用する

sample:

  1.   $this->af->set('foo''bar);
  2.   $smarty->assign('key', 'foo);
  3.   {$key|form_value}
  1.   bar

  • return: フォーム値
string smarty_modifier_form_value (string $string)
  • string $string: フォーム項目名
smarty_modifier_i18n (line 305)

smarty modifier:i18nフィルタ

sample:

  1.   {"english"|i18n}
  1.   英語

  • return: ロケールに対応したメッセージ
string smarty_modifier_i18n (string $string)
  • string $string: i18n処理対象の文字列
smarty_modifier_join (line 109)

smarty modifier:join()

join()関数のwrapper

sample:

  1.   $smarty->assign("array"array(123));
  2.  
  3.   {$array|@join:":"}
  1.   1:2:3

  • return: 連結後の文字列
string smarty_modifier_join (array $array, string $glue)
  • array $array: join対象の配列
  • string $glue: 連結文字列
smarty_modifier_number_format (line 28)

smarty modifier:number_format()

number_format()関数のwrapper

sample:

  1.   {"12345"|number_format}
  1.   12,345

  • return: フォーマット済み文字列
string smarty_modifier_number_format (string $string)
  • string $string: フォーマット対象文字列
smarty_modifier_select (line 363)

smarty modifier:セレクトボックス用フィルタ

単純なセレクトボックスの場合はsmarty関数"select"を利用することで タグを省略可能

sample:

  1.   $smarty->assign("form"1);
  2.  
  3.   <option value="1" {$form|select:"1"}>foo</option>
  4.   <option value="2" {$form|select:"2"}>bar</option>
  1.   <option value="1" selected>foo</option>
  2.   <option value="2" >bar</option>

string smarty_modifier_select (string $string, string $value)
  • string $string: セレクトボックスに渡されたフォーム値
  • string $value: <option>タグに指定されている値
smarty_modifier_strftime (line 55)

smarty modifier:strftime()

strftime()関数のwrapper

sample:

  1.   {"2004/01/01 01:01:01"|strftime:"%Y年%m月%d日"}
  1.   2004年01月01日

  • return: フォーマット済み文字列
string smarty_modifier_strftime (string $string, string $format)
  • string $string: フォーマット対象文字列
  • string $format: 書式指定文字列(strftime()関数参照)
smarty_modifier_truncate_i18n (line 284)

smarty modifier:文字列切り詰め処理(i18n対応)

sample:

  1.   {"日本語です"|truncate_i18n:5:"..."}
  1.   日本...

void smarty_modifier_truncate_i18n ( $string, [int $len = 80], [string $postfix = &quot;...&quot;])
  • int $len: 最大文字幅
  • string $postfix: 末尾に付加する文字列
  • $string
smarty_modifier_unique (line 188)

smarty modifier:unique()

unique()関数のwrapper

sample:

  1.   $smarty->assign("array1"array("a""a""b""a""b""c"));
  2.   $smarty->assign("array2"array(
  3.       array("foo" => 1"bar" => 4),
  4.       array("foo" => 1"bar" => 4),
  5.       array("foo" => 1"bar" => 4),
  6.       array("foo" => 2"bar" => 5),
  7.       array("foo" => 3"bar" => 6),
  8.       array("foo" => 2"bar" => 5),
  9.   ));
  10.  
  11.   {$array1|@unique}
  12.   {$array2|@unique:"foo"}
  1.   abc
  2.   123

  • return: 再構成された配列
array smarty_modifier_unique (array $array, [key $key = null])
  • array $array: 処理対象となる配列
  • key $key: 処理対象となるキー(nullなら配列要素)
smarty_modifier_wordwrap_i18n (line 231)

smarty modifier:文字列のwordwrap処理

[現在EUC-JP対応はEUC-JPのみ対応]

sample:

  1.   {"あいうaえaおaかきaaaくけこ"|wordrap_i18n:8}
  1.   あいうa
  2.   えaおaか
  3.   きaaaく
  4.   けこ

  • return: wordwrap処理された文字列
string smarty_modifier_wordwrap_i18n (string $string, int $width, [string $break = &quot;\n&quot;], [int $indent = 0])
  • string $string: wordwrapする文字列
  • string $break: 改行文字
  • int $width: wordwrap幅(半角$width文字でwordwrapする)
  • int $indent: インデント幅(半角$indent文字)

Documentation generated on Thu, 08 May 2008 00:15:27 +0900 by phpDocumentor 1.4.2