本文整理汇总了PHP中JViewLegacy::_setPath方法的典型用法代码示例。如果您正苦于以下问题:PHP JViewLegacy::_setPath方法的具体用法?PHP JViewLegacy::_setPath怎么用?PHP JViewLegacy::_setPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JViewLegacy
的用法示例。
在下文中一共展示了JViewLegacy::_setPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Sets an entire array of search paths for templates or resources.
*
* @access protected
* @param string $type The type of path to set, typically 'template'.
* @param string|array $path The new set of search paths. If null or
* false, resets to the current directory only.
*/
function _setPath($type, $path)
{
$option = JApplicationHelper::getComponentName();
$app = JFactory::getApplication();
$extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p'));
if (!count($extensions)) {
return parent::_setPath($type, $path);
}
// clear out the prior search dirs
$this->_path[$type] = array();
// actually add the user-specified directories
$this->_addPath($type, $path);
// add extensions paths
if (strtolower($type) == 'template') {
foreach ($extensions as $e => $extension) {
$JLGPATH_EXTENSION = JPATH_COMPONENT_SITE . '/extensions/' . $extension;
// set the alternative template search dir
if (isset($app)) {
if ($app->isAdmin()) {
$this->_addPath('template', $JLGPATH_EXTENSION . '/admin/views/' . $this->getName() . '/tmpl');
} else {
$this->_addPath('template', $JLGPATH_EXTENSION . '/views/' . $this->getName() . '/tmpl');
}
// always add the fallback directories as last resort
$option = preg_replace('/[^A-Z0-9_\\.-]/i', '', $option);
$fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $option . '/' . $extension . '/' . $this->getName();
$this->_addPath('template', $fallback);
}
}
}
}