protected function _initHelper() { $lib_path = APPLICATION_PATH . "/lib"; $view = new Zend_View(); $view->addHelperPath("Cible/View/Helper", "Cible_View_Helper"); $view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper"); $view->addBasePath("{$lib_path}/Cible/View"); $view->addBasePath("{$lib_path}/ZendX/JQuery/View"); $view->addBasePath("{$lib_path}/Cible/Validate"); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); }
/** * Test Function for exceptionAction * * @return void */ public function exceptionAction() { echo "In exception action\n"; $view = new Zend_View(); $view->addBasePath(dirname(dirname(__FILE__)) . '/views'); $view->render('ob.phtml'); }
public function Show($parameters) { $output = ""; $ns = new Zend_Session_Namespace(); $languageID = Languages::get_language_id($ns->lang); $mainviewhelper = new Zend_View(); $mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/'); $view = new Zend_View(); $view->addScriptPath('../library/Shineisp/Custom/views'); $translator = Shineisp_Registry::getInstance()->Zend_Translate; if (!empty($parameters['code'])) { $code = $parameters['code']; } else { return ""; } // Get the products $data = Products::GetProductsByGroupCode($code, $languageID); // Check the existence of the mandatories attributes if (!empty($data['attributes'][0])) { $view->attributes = $data['attributes']; } // Check if there are values set for the group of the product selected if (!empty($data['attributes_values'][0])) { $view->values = $data['attributes_values']; } // Get the products if (!empty($data['products'][0])) { $view->products = $data['products']; } $view->mainviewhelper = $mainviewhelper; // Path of the template return $view->render('productsattributes.phtml'); }
public function init() { parent::init(); $this->view->getHelper('headTitle')->headTitle('VAR_BASE_TITLE'); $this->view->getHelper('HeadMeta')->appendHttpEquiv('pragma', 'no-cache')->appendHttpEquiv('Cache-Control', 'no-cache')->appendHttpEquiv('Content-Type', 'application/xhtml+xml; charset=UTF-8')->appendHttpEquiv('Content-Language', 'pl-PL'); // /->appendName('author', ''); $this->view->getHelper('Doctype')->setDoctype(Zend_View_Helper_Doctype::XHTML11); $this->messages = Dfi_Controller_Action_Helper_Messages::getInstance(); Zend_Controller_Action_HelperBroker::addHelper($this->messages); Zend_Auth::getInstance()->setStorage(new Dfi_Auth_Storage_Cookie('VAR_user')); /* $this->messages->addMessage(Dfi_Controller_Action_Helper_Messages::TYPE_DEBUG, 'test - DEBUG'); $this->messages->addMessage('error', 'test'); $this->messages->addMessage('confirmation', 'test'); $this->messages->addMessage('notice', 'test');*/ $this->view->addHelperPath('View/Helper', 'View_Helper'); $this->view->addBasePath(APPLICATION_PATH . 'views/partials/'); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $view = new Zend_View(); $view->addBasePath(dirname(__FILE__) . '/_files'); Zend_View_Helper_PaginationControl::setDefaultViewPartial(null); $this->_viewHelper = new Zend_View_Helper_PaginationControl(); $this->_viewHelper->setView($view); $this->_paginator = Zend_Paginator::factory(range(1, 101)); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $view = new Zend_View(); $view->addBasePath(dirname(__FILE__) . '/_files'); $view->addHelperPath('Zend/View/Helper/', 'Zend_View_Helper'); $this->_viewHelper = new Zend_View_Helper_PaginationControl(); $this->_viewHelper->setView($view); $this->_paginator = Zend_Paginator::factory(range(1, 101)); }
/** * Reset the view's script paths and set new ones * @todo: Move elsewhere - it shouldn't be in a service * * @param string $module * @param string $type */ private function resetView($module, $type) { $module = ucfirst($module); $layout = Zend_Layout::getMvcInstance(); // Reset view script paths $this->view->setScriptPath(null); // Build new ones for blocks $this->view->addBasePath(ZfApplication::$_base_path . "/app/" . ucfirst($module) . "/views", ucfirst($module) . "_View"); $this->view->addScriptPath(ZfApplication::$_base_path . "/app/Content/views/scripts/{$type}"); $this->view->addScriptPath(ZfApplication::$_base_path . "/app/" . ucfirst($module) . "/views/scripts/{$type}"); $this->view->addScriptPath($layout->getLayoutPath() . "default/templates/" . ucfirst($module) . "/{$type}"); $this->view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/" . ucfirst($module) . "/{$type}"); }
protected function _initDoctype() { ///$this->bootstrap('view'); // $view = $this->getResource('view'); // $view->doctype('XHTML1_STRICT'); //enable class autoloader start require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); $loader->setFallbackAutoloader(true); //enable class autoloader end $frontCtrl = Zend_Controller_Front::getInstance(); $frontCtrl->throwExceptions(true); $frontCtrl->addModuleDirectory(APPLICATION_PATH . '/modules'); //set include path for modules set_include_path(get_include_path() . PATH_SEPARATOR . APPLICATION_PATH . '/modules/'); $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/config.xml', 'production'); //set database adaptor $db = Zend_Db::factory('PDO_MYSQL', $config->resources->db->params); Zend_Registry::set('db', $db); //cache setting start if ($config->configuration->cache) { $frontend = array('lifetime' => 200, 'cache_id_prefix' => 'site_', 'automatic_seralization' => true); $backend = array('cache_dir' => APPLICATION_PATH . '/../cache'); $cache = Zend_Cache::factory('Page', 'File', $frontend, $backend); Zend_Registry::set('cache', $cache); $cache->start(md5($_SERVER['REQUEST_URI'])); } $theme = 'default'; if (isset($config->configuration->theme)) { $theme = $config->configuration->theme; } //theme layout path $layoutPath = APPLICATION_PATH . '/../public/themes/' . $theme . '/templates'; //get module name $arrUrl = array_filter(explode("/", str_replace($config->configuration->base_path, '', $_SERVER['REQUEST_URI']))); $moduleName = current($arrUrl); $modules = array_keys($frontCtrl->getControllerDirectory()); $moduleName = in_array($moduleName, $modules) ? $moduleName : 'default'; $layout = Zend_Layout::startMvc()->setLayout('layout')->setLayoutPath($layoutPath)->setContentKey('content'); //set view render $view = new Zend_View(); $view->addBasePath($layoutPath . "/" . $moduleName); $view->addScriptPath($layoutPath . "/" . $moduleName); $view->doctype('XHTML1_STRICT'); // Add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); }
/** * @override */ public function addBasePath($path, $prefix = 'Zend_View') { $this->_zendView->addBasePath($path, $prefix); return parent::addBasePath($path); }
public function testRendersWithPartial() { $view = new Zend_View(); $view->addBasePath(dirname(__FILE__) . '/Paginator/_files'); $view->addHelperPath(dirname(__FILE__) . '/../../../trunk/library/Zend/View/Helper', 'Zend_View_Helper'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('partial.phtml'); $this->_paginator->setView($view); $string = $this->_paginator->__toString(); $this->assertEquals('partial rendered successfully', $string); }
public function testAddBasePathWithClassPrefix() { $view = new Zend_View(); $base = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'View'; $view->addBasePath($base, 'My_Foo'); $this->_testBasePath($view, $base, 'My_Foo'); }
$registry->set('config', $config); $registry->set('relativeRootPath', $web_root); $registry->set('absolute_web_root', $absolute_web_root); // establishment of the database $db = Zend_Db::factory($app_config->db); Zend_Db_Table::setDefaultAdapter($db); $db->query('SET NAMES utf8'); $registry->set('db', $db); $registry->set('extranet_root', $extranet_path); $registry->set('www_root', $www_root); $registry->set('lucene_index', realpath(dirname(__FILE__) . '/../') . "/indexation/all_index"); // Enables the loading of helpers from /lib/Cible/View/Helper $view = new Zend_View(); $view->addHelperPath("Cible/View/Helper", "Cible_View_Helper"); $view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper"); $view->addBasePath("{$lib_path}/Cible/View"); $view->addBasePath("{$lib_path}/ZendX/JQuery/View"); $view->addBasePath("{$lib_path}/Cible/Validate"); $jquery = $view->jQuery(); $jquery->setCdnVersion('1.4.1'); $jquery->setUiCdnVersion('1.8.2'); $jquery->addStylesheet("{$web_root}/themes/default/css/jquery/smoothness/jquery-ui-1.8.2.custom.css"); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); $frontendOptions = array('lifetime' => 0, 'automatic_serialization' => true); $backendOptions = array('cache_dir' => $cache_path); // getting a Zend_Cache_Core object $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); $registry->set('cache', $cache); // setup the layout
protected function _initView() { // Initialize view $view = new Zend_View(); $view->doctype('XHTML1_STRICT'); $view->addHelperPath(array(_BASE_PATH . 'library/Dfi/View/Helper', 'Dfi/View/Helper/'), 'Dfi_View_Helper_'); $view->addBasePath(APPLICATION_PATH . '/layouts/partials/'); // Add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); //Zend_Form::setDefaultTranslator(new Zend_Translate_Adapter_Array(include(APPLICATION_PATH . '/configs/messages/validation.php'), 'pl')); // Return it, so that it can be stored by the bootstrap return $view; }
/** * Initializes a new view object and loads the view directories into it. * @return Zend_View */ protected function _initView() { $view = new Zend_View(); foreach ($this->getPath('views') as $path) { $view->addBasePath($path); } $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); return $view; }