本文整理汇总了PHP中Zend_Controller_Action_Helper_ViewRenderer::setView方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action_Helper_ViewRenderer::setView方法的具体用法?PHP Zend_Controller_Action_Helper_ViewRenderer::setView怎么用?PHP Zend_Controller_Action_Helper_ViewRenderer::setView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Action_Helper_ViewRenderer
的用法示例。
在下文中一共展示了Zend_Controller_Action_Helper_ViewRenderer::setView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewRenderer
/**
* Retrieves the view renderer object
*
* @return Zend_Controller_Action_Helper_ViewRenderer|null
* @throws Glitch_Application_Resource_Exception
*/
public function getViewRenderer()
{
if (null === $this->_viewRenderer) {
// Pull in the front controller; bootstrap first if necessary
$this->_bootstrap->bootstrap('FrontController');
$front = $this->_bootstrap->getResource('FrontController');
// Ignore if no view renderer is to be used
if ($front->getParam('noViewRenderer')) {
return null;
}
// Get existing renderer, if any, or create a new one
$this->_viewRenderer = Zend_Controller_Action_HelperBroker::hasHelper('viewRenderer') ? Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer') : new $this->_className(null, $this->getOptions());
// Dynamic class loading; perform sanity check
if (!$this->_viewRenderer instanceof Zend_Controller_Action_Helper_ViewRenderer) {
throw new Glitch_Application_Resource_Exception('Class is not a valid view renderer instance');
}
// Register the view as the default view for handling view scripts
$this->_bootstrap->bootstrap('View');
$view = $this->_bootstrap->getResource('View');
$this->_viewRenderer->setView($view);
// It is paramount to set this base path spec: ZF otherwise uses its own
// spec, causing it to create a path to a conventional ZF-style directory
$this->_viewRenderer->setViewBasePathSpec(':module/' . Glitch_View::PATH_VIEW);
// Set empty inflector settings: all path translations are handled by the custom dispatcher
$inflector = new Zend_Filter_Inflector();
$inflector->addRules(array(':module' => array(), ':controller' => array(), ':action' => array()));
$this->_viewRenderer->setInflector($inflector, true);
if (!Zend_Controller_Action_HelperBroker::hasHelper('viewRenderer')) {
Zend_Controller_Action_HelperBroker::addHelper($this->_viewRenderer);
}
}
return $this->_viewRenderer;
}
示例2: _initViewHelpers
protected function _initViewHelpers()
{
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
$view->addHelperPath('Base/View/Helper/', 'Base_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
ZendX_JQuery::enableView($view);
/*------ default blocks in the region right ---*/
/*$blockM=new Base_View_Block();
$path="/layouts/scripts/page/blocks/journal";
$blocks=array("name"=>"search-destination", "order"=>"10", "path"=>$path);
$blockM->addBlock($blocks, 'journal');
$blocks=array("name"=>"right-banner", "order"=>"9", "path"=>$path);
$blockM->addBlock($blocks, 'journal');
$blocks=array("name"=>"recent-blog", "order"=>"8", "path"=>$path);
$blockM->addBlock($blocks, 'journal');
$blocks=array("name"=>"journal-categories", "order"=>"7", "path"=>$path);
$blockM->addBlock($blocks, 'journal');
$blocks=array("name"=>"tag-cloud", "order"=>"6", "path"=>$path);
$blockM->addBlock($blocks, 'journal');*/
/*------ default blocks in the region right ---*/
}
示例3: _initView
protected function _initView()
{
$theme = 'default';
$templatePath = APPLICATION_PATH . '/../public/themes/' . $theme . '/templates';
Zend_Registry::set('user_date_format', 'm-d-Y');
Zend_Registry::set('calendar_date_format', 'mm-dd-yy');
Zend_Registry::set('db_date_format', 'Y-m-d');
Zend_Registry::set('perpage', 10);
Zend_Registry::set('menu', 'home');
Zend_Registry::set('eventid', '');
$dir_name = $_SERVER['DOCUMENT_ROOT'] . rtrim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), '/');
Zend_Registry::set('acess_file_path', $dir_name . SEPARATOR . "application" . SEPARATOR . "modules" . SEPARATOR . "default" . SEPARATOR . "plugins" . SEPARATOR . "AccessControl.php");
Zend_Registry::set('siteconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "site_constants.php");
Zend_Registry::set('emailconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "email_constants.php");
Zend_Registry::set('emptab_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "emptabconfigure.php");
Zend_Registry::set('emailconfig_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "mail_settings_constants.php");
Zend_Registry::set('application_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "application_constants.php");
$date = new Zend_Date();
Zend_Registry::set('currentdate', $date->get('yyyy-MM-dd HH:mm:ss'));
Zend_Registry::set('currenttime', $date->get('HH:mm:ss'));
Zend_Registry::set('logo_url', '/public/images/landing_header.jpg');
$view = new Zend_View();
$view->setEscape('stripslashes');
$view->setBasePath($templatePath);
$view->setScriptPath(APPLICATION_PATH);
$view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
return $this;
}
示例4: setupView
/**
* 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');
}
示例5: _initView
protected function _initView()
{
$view = new Zend_View();
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
示例6: init
/**
* Defined by Zend_Application_Resource_Resource
*
* @return Zend_View
*/
public function init()
{
$view = $this->getView();
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
return $view;
}
示例7: _initView
protected function _initView()
{
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
示例8: _initView
/**
* Initializes a new view object and loads the view directories into it.
* @return Zend_View
*/
protected function _initView()
{
$view = new Zend_View();
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$view->addHelperPath(realpath(implode(DIRECTORY_SEPARATOR, array(ROOT_PATH, 'library', 'Fizzy', 'View', 'Helper'))), 'Fizzy_View_Helper');
$view->addHelperPath(realpath(implode(DIRECTORY_SEPARATOR, array(ROOT_PATH, 'library', 'ZendX', 'JQuery', 'View', 'Helper'))), 'ZendX_JQuery_View_Helper');
return $view;
}
示例9:
function _initViewHelpers()
{
// Config view Zend_Dojo
$view = new Zend_View();
$view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
// End Config view Zend_Dojo
}
示例10: _initDoctype
protected function _initDoctype()
{
$this->bootstrap('view');
// $view = $this->getResource('view');
// $view->doctype('XHTML1_STRICT');
$view = new Zend_View();
$view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
示例11: _initNaneau
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
}
示例12: _initDoctype
protected function _initDoctype()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
$view->doctype('XHTML1_STRICT');
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
示例13: _initView
protected function _initView()
{
$baseUrl = substr($_SERVER['PHP_SELF'], 0, -9);
$view = new Zend_View();
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$view->jQuery()->uiEnable();
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$view->jQuery()->addStylesheet($baseUrl . 'js/jquery/css/overcast/jquery-ui-1.8.11.custom.css')->setLocalPath($baseUrl . 'js/jquery/js/jquery-1.5.1.min.js')->setUiLocalPath($baseUrl . 'js/jquery/js/jquery-ui-1.8.11.custom.min.js');
}
示例14: _initViewHelpers
protected function _initViewHelpers()
{
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
$view->addHelperPath('Base/View/Helper/', 'Base_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
ZendX_JQuery::enableView($view);
}
示例15: testPredispatchWithTwigTemplateEngine
public function testPredispatchWithTwigTemplateEngine()
{
$this->request->setModuleName('foo')->setControllerName('index')->setActionName('bar');
$controller = new Foo_IndexController($this->request, $this->response, array());
$this->helper->setActionController($controller);
$view = new Ano_View();
$engine = new Ano_View_Engine_PhpEngine($view);
$view->addTemplateEngine('twig', $engine);
$this->helper->setView($view);
$this->helper->preDispatch();
$this->assertSame($engine, $this->helper->view->getTemplateEngine());
}