本文整理汇总了PHP中Zend_View_Interface::getScriptPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Interface::getScriptPaths方法的具体用法?PHP Zend_View_Interface::getScriptPaths怎么用?PHP Zend_View_Interface::getScriptPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View_Interface
的用法示例。
在下文中一共展示了Zend_View_Interface::getScriptPaths方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}