Zend FrameworkでSmarty使用時に修正子プラグインを使うには。

Zend FrameworkのViewHelperとしてSmartyを使用している場合に、Smartyの修正子プラグインを使う時、みなさんどのように組み込んでいますか?
とりあえずや、そのコントローラ内でしか使用しない修正子の場合は、コントローラのメソッドとして書き込み、

[php]
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$this->view->getEngine()->register_modifier(
“hoge”,
array($this, ‘smarty_modifier_hoge’)
);
}

public function smarty_modifier_hoge($string)
{
return $string . ” and hoge.”;
}
[/php]

あるいは、

[php]
$this->view->getEngine()->register_modifier(
“hoge”,
array(‘IndexController’,'smarty_modifier_hoge’)
);
[/php]

のように組み込みんだりします。

関連する記事:

Powered by

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">