예제 #1
0
 /**
  * Configures view class
  *
  */
 protected function setupView()
 {
     if (Zend_Registry::isRegistered('config')) {
         $config = Zend_Registry::get('config');
         $renderClass = $config->output->viewrenderer;
         $viewRenderer = new $renderClass();
         $viewClass = $config->output->view->name;
         $viewRenderer->setView(new $viewClass($config->output->view->options->toArray()));
     } else {
         // Config file not detected, use defaults
         $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
         $viewRenderer->setView(new Zoo_View_Php());
     }
     $viewRenderer->setViewSuffix('phtml');
     //make it search for .phtml files
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     //add it to the action helper broker
     // Set the encoding
     $viewRenderer->view->setEncoding("UTF-8");
     $doctypeHelper = new Zend_View_Helper_Doctype();
     $doctypeHelper->doctype('XHTML1_STRICT');
     // Add core module's view helper path
     $viewRenderer->view->addHelperPath(ZfApplication::$_base_path . "/app/Zoo/views/helpers");
     // Add JQuery support
     $viewRenderer->view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
     $viewRenderer->view->jQuery()->setVersion('1.5')->setUIVersion('1.8')->addStylesheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css');
 }
예제 #2
0
 /**
  * @return \Application\Smarty\ZendSmarty
  */
 protected function initView()
 {
     $view = $this->getDICContainer()->get('zend_smarty');
     $view->getEngine()->setZendView($view);
     $viewHelper = new \Zend_Controller_Action_Helper_ViewRenderer($view);
     $viewHelper->setViewSuffix('tpl');
     \Zend_Controller_Action_HelperBroker::addHelper($viewHelper);
     $this->getEventDispatcher()->dispatch('bootstrap.init_view', new EventParameters(array('view' => $view)));
     return $view;
 }
예제 #3
0
 public function _initNaneau()
 {
     /** Naneau_View_Smarty */
     require_once 'Naneau/View/Smarty.php';
     $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
     $viewRenderer->setView(new Naneau_View_Smarty(array('compileDir' => APPLICATION_PATH . '/../tmp/templates_c')));
     $viewRenderer->setViewSuffix('tpl');
     //make it search for .tpl files
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     //add it to the action helper broker
 }
예제 #4
0
 public function _initViewHelpers()
 {
     $this->bootstrap('layout');
     $this->bootstrap('view');
     $layout = $this->getResource('layout');
     $layout->setInflectorTarget(':script.:suffix');
     $layout->setViewSuffix('php');
     $view = $this->getResource('view');
     $view->doctype('XHTML1_STRICT');
     $view->headMeta()->appendHttpEquiv('Content-type', 'text/html;charset=utf-8');
     $view->headTitle()->setSeparator(' - ');
     $view->headTitle('eViasWeb Application');
     $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
     $viewRenderer->setView($view);
     $viewRenderer->setViewSuffix('php');
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
 }
예제 #5
0
 /**
  * @group ZF-11127
  */
 public function testViewSuffixInstanceNotSharedWhenViewHelperIsCloned()
 {
     $a = new Zend_Controller_Action_Helper_ViewRenderer();
     $a->init();
     $a->setViewSuffix('A');
     $this->assertEquals('A', $a->getViewSuffix());
     $b = clone $a;
     $this->assertEquals('A', $b->getViewSuffix());
     $b->setViewSuffix('B');
     $this->assertEquals('B', $b->getViewSuffix());
     $this->assertNotEquals('B', $a->getViewSuffix());
 }
예제 #6
0
 protected function _initView()
 {
     // Create view
     $view = new Zend_View();
     // Set encoding (@todo maybe use configuration?)
     $view->setEncoding('utf-8');
     $view->addScriptPath(APPLICATION_PATH);
     // Setup and register viewRenderer
     // @todo we may not need to override zend's
     $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
     $viewRenderer->setViewSuffix('phtml');
     Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-80, $viewRenderer);
     // Add default helper paths
     $view->addHelperPath('Khcn/View/Helper/', 'Khcn_View_Helper_');
     $this->initViewHelperPath();
     // Set doctype
     $doctypeHelper = new Zend_View_Helper_Doctype();
     $doctypeHelper->doctype('XHTML1_STRICT');
     // Add to local container and registry
     Zend_Registry::set('Zend_View', $view);
     return $view;
 }
예제 #7
0
파일: boot.php 프로젝트: humansky/qframe
/*
 * Register the logging and sanity checking plugins with the front controller
 */
$front->registerPlugin(new QFrame_Controller_Plugin_Log());
/*
 * Register the EzcExecution plugin with the front controller
 */
$front->registerPlugin(new QFrame_Controller_Plugin_EzcExecution());
/*
 * Set up a QFrame_View object, add the path to the helper directory, and set it up
 * as the default view object
 */
$view = new QFrame_View();
$view->addHelperPath(implode(DIRECTORY_SEPARATOR, array(APPLICATION_PATH, 'views', 'helpers')));
$view->addHelperPath(implode(DIRECTORY_SEPARATOR, array(LIBRARY_PATH, 'Zend', 'View', 'Helper')), 'Zend_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
$viewRenderer->setViewSuffix('haml')->setViewScriptPathSpec('scripts/:controller/:action.:suffix');
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
/*
 * Finally, we are going to actually add some routes...
 */
$router = $front->getRouter();
$router->addRoute('default', new Zend_Controller_Router_Route(':controller/:action/:id', array('controller' => 'index', 'action' => 'index', 'id' => 0)));
/*
 * Set up the base url before dispatching
 */
$front->setBaseUrl(QFrame_Config::instance()->base_url);
/*
 * And last of all dispatch the front controller
 */
$front->dispatch();
예제 #8
0
 /**
  * Set VR view suffix
  *
  * @param Zend_Controller_Action_Helper_ViewRenderer $viewRenderer
  * @param Zend_Config $config
  */
 protected function _viewRendererSuffix(Zend_Controller_Action_Helper_ViewRenderer $viewRenderer, Zend_Config $config)
 {
     if ($config->get('suffix') !== null) {
         $viewRenderer->setViewSuffix($config->get('suffix'));
     }
 }
예제 #9
0
 /**
  * Initialization Smarty templating
  *
  * @param string $module
  */
 private function iniViewSmarty($module)
 {
     // Установим шаблоны для модуля
     $vr = new Zend_Controller_Action_Helper_ViewRenderer();
     $vr->setView(new Default_Plugin_ViewSmarty($module));
     $vr->setViewSuffix('tpl');
     Zend_Controller_Action_HelperBroker::addHelper($vr);
 }
예제 #10
0
파일: Bootstrap.php 프로젝트: hoalangoc/ftf
 protected function _initView()
 {
     // Create view
     $view = new Zend_View();
     // Set encoding (@todo maybe use configuration?)
     $view->setEncoding('utf-8');
     $view->addScriptPath(APPLICATION_PATH);
     // Setup and register viewRenderer
     // @todo we may not need to override zend's
     $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
     //$viewRenderer = new Engine_Controller_Action_Helper_ViewRenderer($view);
     $viewRenderer->setViewSuffix('tpl');
     Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-80, $viewRenderer);
     // Initialize contextSwitch helper
     Zend_Controller_Action_HelperBroker::addHelper(new Core_Controller_Action_Helper_ContextSwitch());
     // Add default helper paths
     $view->addHelperPath('Engine/View/Helper/', 'Engine_View_Helper_');
     $this->initViewHelperPath();
     // Set doctype
     Engine_Loader::loadClass('Zend_View_Helper_Doctype');
     $doctypeHelper = new Zend_View_Helper_Doctype();
     $doctypeHelper->doctype(Engine_Api::_()->getApi('settings', 'core')->getSetting('core.doctype', 'HTML4_LOOSE'));
     // Add to local container and registry
     Zend_Registry::set('Zend_View', $view);
     return $view;
 }
예제 #11
0
Zend_Loader::registerAutoload();
require_once '../include/Templater.php';
require_once '../include/CustomControllerAction.php';
//
//    // load the application configuration
$config = new Zend_Config_Ini('../settings.ini', 'development');
Zend_Registry::set('config', $config);
//
//
// create the application logger
$logger = new Zend_Log(new Zend_Log_Writer_Stream($config->logging->file));
Zend_Registry::set('logger', $logger);
//
//
//    // connect to the database
$params = array('host' => $config->database->hostname, 'username' => $config->database->username, 'password' => $config->database->password, 'dbname' => $config->database->database);
$db = Zend_Db::factory($config->database->type, $params);
Zend_Registry::set('db', $db);
//
//
//    // handle the user request
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory($config->paths->base . '/include/Controllers');
//
//    // setup the view renderer
$vr = new Zend_Controller_Action_Helper_ViewRenderer();
$vr->setView(new Templater());
$vr->setViewSuffix('tpl');
Zend_Controller_Action_HelperBroker::addHelper($vr);
//
$controller->dispatch();