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); }