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


PHP Zend_View_Interface::addBasePath方法代码示例

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


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

示例1: plug

 /**
  * Assign the plugin to the view
  * 
  * @param Zend_View_Interface $view
  */
 public function plug(Zend_View_Interface $view)
 {
     $view->addBasePath($this->getTemplatePath());
     if (!isset($view->plugins)) {
         $view->plugins = array();
     }
     $view->plugins[$this->getPHTML()] = $this->getDataArray();
 }
开发者ID:DBezemer,项目名称:server,代码行数:13,代码来源:PartialViewPlugin.php

示例2: render

 private function render()
 {
     $this->layout = $this->getLayout();
     $this->view = $this->getActionController()->view;
     $this->view->addBasePath(APPLICATION_PATH . '/views/partials/');
     $prepend = '';
     $append = '';
     foreach ($this->prependTemplates as $templateName) {
         $prepend .= $this->renderTemplate($templateName);
     }
     foreach ($this->appendTemplates as $templateName) {
         $append .= $this->renderTemplate($templateName);
     }
     if ($append || $prepend) {
         $content = $this->getContent();
         $return = $prepend . $content . $append;
         $this->setContent($return);
     }
 }
开发者ID:dafik,项目名称:dfi,代码行数:19,代码来源:ContentDecorator.php

示例3: 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())
    {
        if (null === $this->view) {
            $this->setView(new Zend_View());
        }

        // Reset some flags every time
        $options['noController'] = (isset($options['noController'])) ? $options['noController'] : false;
        $options['noRender']     = (isset($options['noRender'])) ? $options['noRender'] : false;
        $this->_scriptAction     = null;
        $this->_responseSegment  = null;

        // Set options first; may be used to determine other initializations
        $this->_setOptions($options);

        // Get base view path
        if (empty($path)) {
            $path = $this->_getBasePath();
            if (empty($path)) {
                /**
                 * @see Zend_Controller_Action_Exception
                 */
                require_once 'Zend/Controller/Action/Exception.php';
                throw new Zend_Controller_Action_Exception('ViewRenderer initialization failed: retrieved view base path is empty');
            }
        }

        if (null === $prefix) {
            $prefix = $this->_generateDefaultPrefix();
        }

        // Determine if this path has already been registered
        $currentPaths = $this->view->getScriptPaths();
        $path         = str_replace(array('/', '\\'), '/', $path);
        $pathExists   = false;
        foreach ($currentPaths as $tmpPath) {
            $tmpPath = str_replace(array('/', '\\'), '/', $tmpPath);
            if (strstr($tmpPath, $path)) {
                $pathExists = true;
                break;
            }
        }
        if (!$pathExists) {
            $this->view->addBasePath($path, $prefix);
        }

        // Register view with action controller (unless already registered)
        if ((null !== $this->_actionController) && (null === $this->_actionController->view)) {
            $this->_actionController->view       = $this->view;
            $this->_actionController->viewSuffix = $this->_viewSuffix;
        }
    }
开发者ID:ragsnas,项目名称:group_gtd,代码行数:72,代码来源:ViewRenderer.php


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