當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。