ZendFramework Part2at PHP
ZendFramework Part2 - 暇つぶし2ch58:nobodyさん
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に↑の奴を書いています。
エラーがでるでもなく、真っ白な何もない画面が表示されてしまいます。



次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch