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


PHP Zend_View_Abstract::setScriptPath方法代码示例

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


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

示例1: render

 /**
  * Render a hook's content
  *
  * @param string $name template to use
  * @param string $module module to fetch template from
  * @param string $controller controller to fetch template from, defaults to 'hooks'
  *
  * @return string Rendered content
  *
  */
 public function render($name, $module, $controller = "hooks")
 {
     $layout = Zend_Layout::getMvcInstance();
     // Reset view script paths
     $this->view->setScriptPath(null);
     // Build new ones for hooks
     $this->view->addBasePath(ZfApplication::$_base_path . "/app/{$module}/views", $module . "_View");
     //$this->view->addScriptPath(ZfApplication::$_base_path."/app/$module/Views/");
     $this->view->addScriptPath($layout->getLayoutPath() . "default/templates/{$module}");
     $this->view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/{$module}");
     return $this->view->render($controller . "/" . $name);
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:22,代码来源:Abstract.php

示例2: _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

示例3: setScriptPath

 public function setScriptPath($path)
 {
     $this->_pathSet = false;
     return parent::setScriptPath($path);
 }
开发者ID:BGCX262,项目名称:zwig-svn-to-git,代码行数:5,代码来源:View.php

示例4: resetViewScripts

 /**
  * Reset the view's script paths and set new ones for use in the block
  *
  * @param Zend_View_Abstract $view
  */
 private function resetViewScripts(Zend_View_Abstract $view)
 {
     $layout = Zend_Layout::getMvcInstance();
     // Reset view script paths
     $view->setScriptPath(null);
     $module = ucfirst($this->module);
     // Build new ones for blocks
     $view->addBasePath(ZfApplication::$_base_path . "/app/{$module}/views", $module . "_View");
     $view->addScriptPath(ZfApplication::$_base_path . "/app/{$module}/views/scripts/blocks");
     $view->addScriptPath($layout->getLayoutPath() . "default/templates/blocks");
     $view->addScriptPath($layout->getLayoutPath() . "default/templates/{$module}/blocks");
     $view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/blocks");
     $view->addScriptPath($layout->getLayoutPath() . $layout->getLayout() . "/templates/{$module}/blocks");
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:19,代码来源:Abstract.php


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