<?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initAutoload() { 'namespace' => 'Default_', )); return $autoloader; } function _initViewHelpers() { ... $config = Zend_Registry::get('config'); require_once 'Core/View/Smarty.php'; //setup new view object and view helper $config = Zend_Registry::get('config'); $view = new Core_View_Smarty(); $view->setCompilePath($config->smarty->compile_dir); $view->setCachePath($config->smarty->cache_dir); $view->setConfigPath($config->smarty->config_dir); $view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper'); $this->view = $view; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer->setViewSuffix('tpl') ->setView($view); //use layout view pattern $layout = Zend_Layout::startMvc(); $layout->setViewSuffix('tpl') $layout->menu = .. ... $this->view->layout = $layout; $this->view->layout->zendView = new Zend_View(); $this->view->layout->zendView->location = $config->location; $layout->view->location = $config->location; $view->assign( 'layout', $layout ); $view->assign( 'this', $this->view->layout->zendView); $view->assign( 'view', $this->view); } ... }
Teraz szablon .tpl:
{php} echo $view->dojo()->isEnabled(){/php}
Na koniec błąd:
Kod
Fatal error: Call to a member function dojo() on a non-object in /var/www/......./cache/templates_c/%%FD^FDB^FDB64EFD%%layout.tpl.php on line 15