本文整理汇总了PHP中T3::getSite方法的典型用法代码示例。如果您正苦于以下问题:PHP T3::getSite方法的具体用法?PHP T3::getSite怎么用?PHP T3::getSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类T3
的用法示例。
在下文中一共展示了T3::getSite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public static function display()
{
//load language for template
JFactory::getLanguage()->load('tpl_' . T3_TEMPLATE, JPATH_SITE);
$japp = JFactory::getApplication();
if (!$japp->isAdmin()) {
$tpl = $japp->getTemplate(true);
} else {
$tplid = JFactory::getApplication()->input->getCmd('view') == 'style' ? JFactory::getApplication()->input->getCmd('id', 0) : false;
if (!$tplid) {
die(json_encode(array('error' => JText::_('T3_MSG_UNKNOW_ACTION'))));
}
$cache = JFactory::getCache('com_templates', '');
if (!($templates = $cache->get('t3tpl'))) {
// Load styles
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, home, template, s.params');
$query->from('#__template_styles as s');
$query->where('s.client_id = 0');
$query->where('e.enabled = 1');
$query->leftJoin('#__extensions as e ON e.element=s.template AND e.type=' . $db->quote('template') . ' AND e.client_id=s.client_id');
$db->setQuery($query);
$templates = $db->loadObjectList('id');
foreach ($templates as &$template) {
$registry = new JRegistry();
$registry->loadString($template->params);
$template->params = $registry;
}
$cache->store($templates, 't3tpl');
}
if (isset($templates[$tplid])) {
$tpl = $templates[$tplid];
} else {
$tpl = $templates[0];
}
}
ob_clean();
$t3app = T3::getSite($tpl);
$layout = $t3app->getLayout();
$t3app->loadLayout($layout);
$lbuffer = ob_get_clean();
die($lbuffer);
}