当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Action_Helper_ViewRenderer::initView方法代码示例

本文整理汇总了PHP中Zend_Controller_Action_Helper_ViewRenderer::initView方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action_Helper_ViewRenderer::initView方法的具体用法?PHP Zend_Controller_Action_Helper_ViewRenderer::initView怎么用?PHP Zend_Controller_Action_Helper_ViewRenderer::initView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Controller_Action_Helper_ViewRenderer的用法示例。


在下文中一共展示了Zend_Controller_Action_Helper_ViewRenderer::initView方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initView

 /**
  * @param null $path
  * @param null $prefix
  * @param array $options
  */
 public function initView($path = null, $prefix = null, array $options = array())
 {
     if (null === $this->view) {
         $view = new View();
         $view->setRequest($this->getRequest());
         $view->addHelperPath(PIMCORE_PATH . "/lib/Pimcore/View/Helper", "\\Pimcore\\View\\Helper\\");
         $this->setView($view);
     }
     parent::initView($path, $prefix, $options);
     $this->setViewSuffix(View::getViewScriptSuffix());
     // this is very important, the initView could be called multiple times.
     // if we add the path on every call, we have big performance issues.
     if ($this->isInitialized) {
         return;
     }
     $this->isInitialized = true;
     $paths = $this->view->getScriptPaths();
     // script pathes for layout path
     foreach (array_reverse($paths) as $path) {
         $path = str_replace("\\", "/", $path);
         if (!in_array($path, $paths)) {
             $this->view->addScriptPath($path);
         }
         $path = str_replace("/scripts", "/layouts", $path);
         if (!in_array($path, $paths)) {
             $this->view->addScriptPath($path);
         }
     }
 }
开发者ID:Gerhard13,项目名称:pimcore,代码行数:34,代码来源:ViewRenderer.php

示例2: testInitViewWithOptions

 public function testInitViewWithOptions()
 {
     $this->request->setModuleName('foo')->setControllerName('index');
     $controller = new Foo_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $viewDir = dirname(__FILE__) . str_repeat(DIRECTORY_SEPARATOR . '..', 2) . DIRECTORY_SEPARATOR . 'views';
     $this->helper->initView($viewDir, 'Baz_Bat', array('neverRender' => true, 'noRender' => true, 'noController' => true, 'viewSuffix' => 'php', 'scriptAction' => 'foo', 'responseSegment' => 'baz'));
     $this->assertTrue($this->helper->getNeverRender());
     $this->assertTrue($this->helper->getNoRender());
     $this->assertTrue($this->helper->getNoController());
     $this->assertEquals('php', $this->helper->getViewSuffix());
     $this->assertEquals('foo', $this->helper->getScriptAction());
     $this->assertEquals('baz', $this->helper->getResponseSegment());
     $scriptPaths = $this->helper->view->getScriptPaths();
     $scriptPath = $scriptPaths[0];
     $this->assertContains($viewDir, $scriptPath);
     $helperPaths = $this->helper->view->getHelperPaths();
     $found = false;
     foreach ($helperPaths as $path) {
         if ('Baz_Bat_Helper_' == $path['prefix']) {
             $found = true;
         }
     }
     $this->assertTrue($found, 'Helper prefix not set according to spec: ' . var_export($helperPaths, 1));
     $filterPaths = $this->helper->view->getFilterPaths();
     $found = false;
     foreach ($filterPaths as $path) {
         if ('Baz_Bat_Filter_' == $path['prefix']) {
             $found = true;
         }
     }
     $this->assertTrue($found, 'Filter prefix not set according to spec' . var_export($filterPaths, 1));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:33,代码来源:ViewRendererTest.php

示例3: testStockInflectorWorksWithViewBaseSpec

 /**
  * @see ZF-2443
  */
 public function testStockInflectorWorksWithViewBaseSpec()
 {
     $this->request->setModuleName('bar')->setControllerName('index')->setActionName('admin');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $this->helper->setViewBasePathSpec(':moduleDir/:module');
     $this->helper->initView();
     $viewScriptPaths = $this->helper->view->getAllPaths();
     $expectedPathRegex = '#modules/bar/bar/scripts/$#';
     $this->assertRegExp($expectedPathRegex, $this->_normalizePath($viewScriptPaths['script'][0]));
     $this->assertEquals($this->helper->getViewScript(), 'index/admin.phtml');
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:15,代码来源:ViewRendererTest.php

示例4: testStockInflectorWorksWithViewBaseSpec

 /**
  * @see ZF-2443
  */
 public function testStockInflectorWorksWithViewBaseSpec()
 {
     $this->request->setModuleName('bar')->setControllerName('index')->setActionName('admin');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $this->helper->setViewBasePathSpec(':moduleDir/:module');
     $this->helper->initView();
     $viewScriptPaths = $this->helper->view->getAllPaths();
     // we need this until View decides to not use DIRECTORY_SEPARATOR
     $expectedPathRegex = DIRECTORY_SEPARATOR == '\\' ? '#modules\\\\bar\\\\bar\\\\scripts\\\\$#' : '#modules/bar/bar/scripts/$#';
     $this->assertRegExp($expectedPathRegex, $viewScriptPaths['script'][0]);
     $this->assertEquals($this->helper->getViewScript(), 'index/admin.phtml');
 }
开发者ID:lortnus,项目名称:zf1,代码行数:16,代码来源:ViewRendererTest.php

示例5: initView

 /**
  * @param null $path
  * @param null $prefix
  * @param array $options
  */
 public function initView($path = null, $prefix = null, array $options = array())
 {
     if (null === $this->view) {
         $view = new Pimcore_View();
         $view->setRequest($this->getRequest());
         $view->addHelperPath(PIMCORE_PATH . "/lib/Pimcore/View/Helper", "Pimcore_View_Helper_");
         $this->setView($view);
     }
     parent::initView($path, $prefix, $options);
     // script pathes for layout path
     foreach (array_reverse($this->view->getScriptPaths()) as $path) {
         $path = str_replace("\\", "/", $path);
         $this->view->addScriptPath($path);
         $this->view->addScriptPath(str_replace("/scripts", "/layouts", $path));
     }
     $this->setViewSuffix(Pimcore_View::getViewScriptSuffix());
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:22,代码来源:ViewRenderer.php

示例6: testStockInflectorWorksWithViewBaseSpec

    /**
     * @issue ZF-2443
     */
    public function testStockInflectorWorksWithViewBaseSpec()
    {
        $this->request->setModuleName('bar')  // bar must exist so the ViewRendere doesnt throw an exception
                      ->setControllerName('index')
                      ->setActionName('admin');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
                      
        $this->helper->setView($view = new Zend_View());
        $this->helper->setViewBasePathSpec(':moduleDir/:module');
        $this->helper->initView();
        
        $viewScriptPaths = $view->getAllPaths(); 

        $this->assertRegExp('#modules/bar/bar/scripts/$#', $viewScriptPaths['script'][0]);
        $this->assertEquals($this->helper->getViewScript(), 'index/admin.phtml');
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:20,代码来源:ViewRendererTest.php

示例7: testStockInflectorWorksWithViewBaseSpec

    /**
     * @group ZF-2443
     */
    public function testStockInflectorWorksWithViewBaseSpec()
    {
        $this->request->setModuleName('bar')  // bar must exist so the ViewRendere doesnt throw an exception
                      ->setControllerName('index')
                      ->setActionName('admin');
        $controller = new \Bar\IndexController($this->request, $this->response, array());
        $controller->setHelperBroker($this->broker);
        $this->helper->setActionController($controller);

        $this->helper->setViewBasePathSpec(':moduleDir/:module');
        $this->helper->initView();

        $viewScriptPaths = $this->helper->view->resolver()->getPaths();

        $expectedPathRegex = '#modules/bar/bar/scripts/$#';
        $this->assertRegExp(
            $expectedPathRegex,
            $this->_normalizePath($viewScriptPaths[0])
            );
        $this->assertEquals($this->helper->getViewScript(), 'index/admin.phtml');
    }
开发者ID:alab1001101,项目名称:zf2,代码行数:24,代码来源:ViewRendererTest.php

示例8: initView

 /**
  * Initialize the view object
  *
  * $options may contain the following keys:
  * - neverRender - flag dis/enabling postDispatch() autorender (affects all subsequent calls)
  * - noController - flag indicating whether or not to look for view scripts in subdirectories named after the controller
  * - noRender - flag indicating whether or not to autorender postDispatch()
  * - responseSegment - which named response segment to render a view script to
  * - scriptAction - what action script to render
  * - viewBasePathSpec - specification to use for determining view base path
  * - viewScriptPathSpec - specification to use for determining view script paths
  * - viewScriptPathNoControllerSpec - specification to use for determining view script paths when noController flag is set
  * - viewSuffix - what view script filename suffix to use
  *
  * @param  string $path
  * @param  string $prefix
  * @param  array  $options
  * @throws Zend_Controller_Action_Exception
  * @return void
  */
 public function initView($path = null, $prefix = null, array $options = array())
 {
     $this->setView($this->getServiceLocator()->get('View'));
     parent::initView($path, $prefix, $options);
 }
开发者ID:xemlock,项目名称:HumusMvc,代码行数:25,代码来源:ViewRenderer.php


注:本文中的Zend_Controller_Action_Helper_ViewRenderer::initView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。