本文整理汇总了PHP中JSite::getCfg方法的典型用法代码示例。如果您正苦于以下问题:PHP JSite::getCfg方法的具体用法?PHP JSite::getCfg怎么用?PHP JSite::getCfg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSite
的用法示例。
在下文中一共展示了JSite::getCfg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: global_render
function global_render()
{
global $mainframe;
// Base instances
$document =& JFactory::getDocument();
$user =& JFactory::getUser();
// Define global template
$_template = "_global";
$_template_dir = JPATH_THEMES . DS . $_template;
// example includes/application.php "render" function
$file = JRequest::getCmd('tmpl', 'index');
if (JSite::getCfg('offline') && $user->get('gid') < '23') {
$file = 'offline';
}
if (!is_dir($_template_dir) && !JSite::getCfg('offline')) {
$file = 'component';
}
$params = array('template' => $_template, 'file' => $file . '.php', 'directory' => JPATH_THEMES);
// Catch current template
$template = $mainframe->getTemplate();
$template_dir = JPATH_THEMES . DS . $template;
// Set global template as current and render document
$mainframe->setTemplate('_global');
$data = $document->render(JSite::getCfg('caching'), $params);
// Set back current template
$mainframe->setTemplate($template);
$replace = array();
$matches = array();
// Catch own construction for include files
// (example /libraties/joomla/document/html/html.php "_parseTemplate" function)
if (preg_match_all('#<jdoc:file\\ name="([^"]+)".*\\/>#iU', $data, $matches)) {
$matches[0] = array_reverse($matches[0]);
$matches[1] = array_reverse($matches[1]);
$count = count($matches[1]);
for ($i = 0; $i < $count; $i++) {
$inc = $matches[1][$i];
$tpl_dir = $template_dir;
// if file does not exist in current template,
// looking for it in "_global" teamplate dir
if (!file_exists($template_dir . DS . $inc)) {
$tpl_dir = $_template_dir;
}
$tpl = $document->_loadTemplate($tpl_dir, $inc);
$tpl = $document->_parseTemplate($tpl);
$replace[$i] = $tpl;
}
$data = str_replace($matches[0], $replace, $data);
}
return $data;
}