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


PHP Zend_Controller_Action_Helper_ViewRenderer::renderScript方法代码示例

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


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

示例1: testRenderScriptToPreviouslyNamedResponseSegment

 public function testRenderScriptToPreviouslyNamedResponseSegment()
 {
     $this->request->setModuleName('bar')->setControllerName('index')->setActionName('test');
     $controller = new Bar_IndexController($this->request, $this->response, array());
     $this->helper->setResponseSegment('foo');
     $this->helper->renderScript('index/test.phtml');
     $body = $this->response->getBody('foo');
     $this->assertContains('Rendered index/test.phtml in bar module', $body);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:9,代码来源:ViewRendererTest.php

示例2: renderScript

 /**
  * This function updates the ViewRender helper to add another view directory
  * which is located in the templates directory.
  *
  * This adds the feature to override view script in certain templates.
  *
  * @param  string $script
  * @param  string $name
  * @return void
  */
 public function renderScript($script, $name = null)
 {
     $application = $this->getFrontController()->getParam('application');
     $module = $this->getModule();
     $viewScriptPath = trim($this->view->layout()->getViewScriptPath(), DIRECTORY_SEPARATOR);
     $scriptPath = $viewScriptPath . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $application . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR;
     if (!in_array($scriptPath, $this->view->getScriptPaths())) {
         $this->view->addScriptPath($scriptPath);
     }
     parent::renderScript($script, $name);
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:21,代码来源:ViewRenderer.php

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