Witam,

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:

  1. [production]
  2. phpSettings.display_startup_errors = 0
  3. phpSettings.display_errors = 0
  4. includePaths.library = APPLICATION_PATH "/../library"
  5. bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
  6. bootstrap.class = "Bootstrap"
  7. resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
  8. resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
  9. resources.view[] =
  10. ;ources.db.adapter = "PDO_SQLITE"
  11.  
  12. [staging : production]
  13.  
  14. [testing : production]
  15. phpSettings.display_startup_errors = 1
  16. phpSettings.display_errors = 1
  17.  
  18. [development : production]
  19. phpSettings.display_startup_errors = 1
  20. phpSettings.display_errors = 1
  21. resources.db.adapter = "pdo_mysql"
  22. resources.db.params.host = "localhost"
  23. resources.db.params.username = "user123"
  24. resources.db.params.password = "*****"
  25. resources.db.params.dbname = "zend-test"
  26.  
  27. ;######################################################################
  28. ;;# Smarty templates configurtion paths
  29. ;;#
  30. ;;######################################################################
  31. smarty.compile_dir = "../cache/templates_c/"
  32. smarty.cache_dir = "../cache/cache_smarty/"
  33. smarty.template_dir = "../application/views/templates"
  34. smarty.config_dir = "../application"


index.php
  1. error_reporting(E_ALL|E_STRICT);
  2. date_default_timezone_set('Europe/London');
  3.  
  4. // Define path to application directory
  5. defined('APPLICATION_PATH')
  6. || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
  7.  
  8. // Define application environment
  9. defined('APPLICATION_ENV')
  10. || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
  11.  
  12. // Ensure library/ is on include_path
  13. set_include_path(implode(PATH_SEPARATOR, array(
  14. realpath(APPLICATION_PATH . '/../library'),
  15. )));
  16.  
  17. require_once '../library/Smarty.php';
  18.  
  19. /** Zend_Application */
  20. require_once 'Zend/Application.php';
  21.  
  22. // Create application, bootstrap, and run
  23. $application = new Zend_Application(
  24. APPLICATION_ENV,
  25. APPLICATION_PATH . '/configs/application.ini'
  26. );
  27.  
  28. $application->bootstrap()->run();


plik do obsługi smartów pobralem w powyższego kursu, zaś wywołanie odbywa się tak:

  1. public function indexAction()
  2. {
  3. // action body
  4.  
  5. $guestbook = new Default_Model_Guestbook();
  6. $this->view->entries = $guestbook->fetchAll();
  7.  
  8. $view = new Album_View_Smarty();
  9. $view->setScriptPath("../application/views/templates");
  10. $view->setCompilePath("../cache/templates_c/");
  11. $view->setCachePath("../cache/cache_smarty/");
  12. $view->setConfigPath("../application");
  13.  
  14. $view->assign('guestbook/guestbook.tpl', $this->view);
  15. }
  16.  


aha i jeszcze jedno pytanie:) jak w php pobrać zmienną smarty.compile_dir z configa?