08/04/11 21:49:28
ZFでsmarty使う方法がいまいちわかりません。
検索してもサイトによって書いてる事がばらばらだったりで。
ZFにあるinterfaceから継承したsmarty用クラスは作成しました。
ここからなにをすればいいんでしょう?
$opt = array(
'templete_dir' => '../application/views/scripts/index',
'compile_dir' => '../../var/templates_c'
);
$smarty = new Common_View_Smarty(null, $opt);
$smarty->assign("books", "テスト");
$smarty->render("index.tpl");
これがアクション内の記述なんですが、何か変なところはあるでしょうか?
やったことは、
・PHP.iniにsmartyのincludeパスを通す。
・URLリンク(wadslab.net)
を参考にZend_View_Interfaceを実装したCommon_View_Smartyを作成
・index.phpの中身は
Zend_Session::start();
Zend_Controller_Front::getInstance()->setParam('noViewRenderer',true);
Zend_Controller_Front::run('../application/controllers');
これだけ
でIndexController.phpの中のindexActionに↑の奴を書いています。
エラーがでるでもなく、真っ白な何もない画面が表示されてしまいます。