當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Controller_Action_Helper_ViewRenderer::getViewScript方法代碼示例

本文整理匯總了PHP中Zend_Controller_Action_Helper_ViewRenderer::getViewScript方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Controller_Action_Helper_ViewRenderer::getViewScript方法的具體用法?PHP Zend_Controller_Action_Helper_ViewRenderer::getViewScript怎麽用?PHP Zend_Controller_Action_Helper_ViewRenderer::getViewScript使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Controller_Action_Helper_ViewRenderer的用法示例。


在下文中一共展示了Zend_Controller_Action_Helper_ViewRenderer::getViewScript方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testActionsWithLeadingCapitalLettersShouldNotInvokeTruncatedViewScripts

 /**
  * @group ZF-10725
  */
 public function testActionsWithLeadingCapitalLettersShouldNotInvokeTruncatedViewScripts()
 {
     $this->request->setModuleName('default')->setControllerName('Controller')->setActionName('Action');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $scriptName = $this->helper->getViewScript();
     $this->assertEquals('controller/action.phtml', $scriptName);
 }
開發者ID:ThorstenSuckow,項目名稱:conjoon,代碼行數:11,代碼來源:ViewRendererTest.php

示例2: testGetViewScriptWithNoControllerSet

 public function testGetViewScriptWithNoControllerSet()
 {
     $this->request->setModuleName('bar')->setControllerName('index')->setActionName('test');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setNoController();
     $expected = 'test.phtml';
     $this->assertEquals($expected, $this->helper->getViewScript());
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:8,代碼來源:ViewRendererTest.php

示例3: testViewScriptNameDoesNotIncludeDisallowedCharacters

 /**
  * @group ZF-10725
  * @dataProvider providerViewScriptNameDoesNotIncludeDisallowedCharacters
  */
 public function testViewScriptNameDoesNotIncludeDisallowedCharacters($actionName)
 {
     $this->request->setModuleName('default')->setControllerName('foo')->setActionName($actionName);
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $scriptName = $this->helper->getViewScript();
     $this->assertEquals('foo/my-bar.phtml', $scriptName);
 }
開發者ID:htecvc2x,項目名稱:htecvc2x-zf-training,代碼行數:12,代碼來源:ViewRendererTest.php

示例4: testStockInflectorWorksWithDottedRequestParts

 /**
  * @see ZF-2738
  */
 public function testStockInflectorWorksWithDottedRequestParts()
 {
     $this->request->setModuleName('foo')->setControllerName('car.bar')->setActionName('baz');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $viewScriptPaths = $this->helper->view->getAllPaths();
     $expectedPathRegex = '#modules/foo/views/scripts/$#';
     $this->assertRegExp($expectedPathRegex, $this->_normalizePath($viewScriptPaths['script'][0]));
     $this->assertEquals('car-bar/baz.phtml', $this->helper->getViewScript());
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:13,代碼來源:ViewRendererTest.php

示例5: testRenderNormalizationIsCorrect

 public function testRenderNormalizationIsCorrect()
 {
     $this->request->setModuleName('default')->setControllerName('foo')->setActionName('myBar');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setActionController($controller);
     $scriptName = $this->helper->getViewScript();
     $this->assertEquals('foo/mybar.phtml', $scriptName);
     $this->request->setModuleName('default')->setControllerName('foo')->setActionName('baz__bat');
     $scriptName = $this->helper->getViewScript();
     $this->assertEquals('foo/baz-bat.phtml', $scriptName);
     $this->request->setModuleName('default')->setControllerName('Foo_Bar')->setActionName('bar__baz');
     $scriptName = $this->helper->getViewScript();
     $this->assertEquals('foo/bar/bar-baz.phtml', $scriptName);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:14,代碼來源:ViewRendererTest.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: _renderDefaultScript

 /**
  * Tries to render a delegate action's default template if it exists.
  *
  * Because we can't always know the short name of a delegate (like we can
  * with a controller), the default view spec of :controller/:action:suffix
  * won't work for us. This means we can't just prepend our default paths to
  * the view script paths. Instead, this function changes the viewRenderer
  * spec to just :action:suffix, puts in the default dirs, tries to render
  * and then flips back the settings afterwards. 
  *
  * @todo Ugly, needs refactoring
  * @param Zend_Controller_Action_Helper_ViewRenderer $viewRenderer
  * @param Zend_View_Abstract $view
  * @param string $action Name of the action, without the "Action" suffix
  */
 protected function _renderDefaultScript($viewRenderer, $view, $action)
 {
     //No settings? Abort to save cycles
     $defaultPaths = $this->getDefaultScriptPaths();
     if (empty($defaultPaths)) {
         return;
     }
     //Save the old settings
     $oldSpec = $viewRenderer->getNoController();
     $oldPaths = $view->getScriptPaths();
     //Set the viewrenderer spec to look inside a flat directory
     $viewRenderer->setNoController(true);
     $view->setScriptPath($defaultPaths);
     $path = $viewRenderer->getViewScript($action);
     //relative path
     $fullPath = $view->getScriptPath($path);
     //absolute path
     //We use the full path to make sure this template actually exists on
     //disc but Zend_View will only accept a path relative to a script dir.
     if (!empty($fullPath) !== false) {
         $viewRenderer->renderScript($path);
     }
     //Reset view settings so we don't botch anything afterwards?
     $viewRenderer->setNoController($oldSpec);
     $view->setScriptPath($oldPaths);
 }
開發者ID:rosstuck,項目名稱:trifle,代碼行數:41,代碼來源:DelegateAbstract.php


注:本文中的Zend_Controller_Action_Helper_ViewRenderer::getViewScript方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。