2006-06-04 (日)
■ Ethna のテンプレートエンジンに Simplate を使う (4)
Ethna の Ethna_SmartyPlugin.php を見てみたが、 smarty_function_is_error() と smarty_function_message() 相当の機能は使えた方が良さそうだ。
smarty_function_is_error() については、 is_error() というメソッドが Ethna_Util.php で定義されていたので、 それを使えばOK。
smarty_function_message() の方はどうすればいいか?
function smarty_function_message($params, &$smarty)
{
$c =& Ethna_Controller::getInstance();
extract($params);
$action_error =& $c->getActionError();
print htmlspecialchars($action_error->getMessage($name));
}
これをまねて、以下のようなメソッドを、 昨日の Ethna_Simplate.php に追加する。
function error_message($name)
{
$c =& Ethna_Controller::getInstance();
$action_error =& $c->getActionError();
print htmlspecialchars($action_error->getMessage($name));
}
使う時は、テンプレートの中で、 {error_message('password')} のように書けばよい。
■ Ethna のテンプレートエンジンに Simplate を使う (5)
これまでの実験結果を Wiki に、 Ethna のテンプレートエンジンに Simplate を使う としてまとめておいた。
いくらか試行錯誤したが、結果的には、 Ethna で Simplate を使うのは非常に簡単だと言えると思う。
[コメントを書く]
本日のリンク元
- 2 google検索(ethna テンプレート サンプル)
- 1 google検索(Ethna_Util.php)
- 1 google検索(Ethna getInstance)
- 1 google検索(ethna getActionError)
- 1 google検索(Ethna prepared DB)
- 1 google検索(Simplate ethna)
- 1 google検索(ethna htmlspecialchars)
- 1 google検索(zend framework wiki engine)
- 1 google検索(smarty_function_is_error)
- 1 google検索(ethna yml)
- 1 google検索(Ethna_SmartyPlugin)
- 1 google検索(Ethna Action_Error)
- 1 google検索(PHP テンプレート エンジン C)
- 1 google検索(getActionError ethna)
- 1 google検索(Ethna_Controller getInstance)
- 1 google検索( Ethna_Controller::getInstance();)
- 1 google検索(action_error ethna)
- 1 google検索(ethna getMessage)
- 1 google検索(Ethna_SmartyPlugin テンプレート)
- 1 http://72.14.235.104/search?q=cache:3ziqdCpJ3MkJ:w...
