znacie jakąś szybka i przystępną metode wprowadzenia smartów do zenda? Korzystałem z http://www.heavymind.net/zend-framework-tu...entacja-smarty/ ale nie wiem dlaczego otrzymuję komunikat:
Fatal error:
Uncaught exception 'Zend_View_Exception' with message 'script 'error/error.phtml' not found in path (/home/user123/public_html/zend-test/1/application/views/scripts/)' in /home/user123/public_html/zend-test/1/library/Zend/View/Abstract.php:925
Stack trace:
#0 /home/user123/public_html/zend-test/1/library/Zend/View/Abstract.php(828): Zend_View_Abstract->_script('error/error.pht...')
#1 /home/user123/public_html/zend-test/1/library/Zend/Controller/Action/Helper/ViewRenderer.php(902): Zend_View_Abstract->render('error/error.pht...')
#2 /home/user123/public_html/zend-test/1/library/Zend/Controller/Action/Helper/ViewRenderer.php(923): Zend_Controller_Action_Helper_ViewRenderer->renderScript('error/error.pht...', NULL)
#3 /home/user123/public_html/zend-test/1/library/Zend/Controller/Action/Helper/ViewRenderer.php(962): Zend_Controller_Action_Helper_ViewRenderer->render() #4 /home/user123/public_html/zend-test/1/library/Zend/Controller/Action/HelperBroker.php(276): Zend_Controller_Action_Helper_ViewRenderer->postDispatch() #5 /ho in /home/user123/public_html/zend-test/1/library/Zend/View/Abstract.php on line 925
co należy ustawić aby smarty były odpowiedzialne za wyszukiwanie plików tpl w views/templates/*.tpl, a nie w views/scripts/*.php
mój config:
[production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.view[] = ;ources.db.adapter = "PDO_SQLITE" [staging : production] [testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.db.adapter = "pdo_mysql" resources.db.params.host = "localhost" resources.db.params.username = "user123" resources.db.params.password = "*****" resources.db.params.dbname = "zend-test" ;###################################################################### ;;# Smarty templates configurtion paths ;;# ;;###################################################################### smarty.compile_dir = "../cache/templates_c/" smarty.cache_dir = "../cache/cache_smarty/" smarty.template_dir = "../application/views/templates" smarty.config_dir = "../application"
index.php
date_default_timezone_set('Europe/London'); // Define path to application directory // Define application environment // Ensure library/ is on include_path ))); require_once '../library/Smarty.php'; /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap()->run();
plik do obsługi smartów pobralem w powyższego kursu, zaś wywołanie odbywa się tak:
public function indexAction() { // action body $guestbook = new Default_Model_Guestbook(); $this->view->entries = $guestbook->fetchAll(); $view = new Album_View_Smarty(); $view->setScriptPath("../application/views/templates"); $view->setCompilePath("../cache/templates_c/"); $view->setCachePath("../cache/cache_smarty/"); $view->setConfigPath("../application"); $view->assign('guestbook/guestbook.tpl', $this->view); }
aha i jeszcze jedno pytanie:) jak w php pobrać zmienną smarty.compile_dir z configa?