/** * Get active layout name * * @return string */ public static function get_active_layout() { //return T3Parameter::_getParam('layouts'); $params = T3Common::get_template_params(); $device = T3Common::mobile_device_detect(); if (!$device) { //desktop // Get from override profile $active_profile = T3Common::get_active_profile(); $default_profile = T3Common::get_default_profile(); if ($active_profile != $default_profile && $active_profile != 'default') { $file = self::getFilePath($active_profile, 'profiles'); if (is_file($file)) { $content = file_get_contents($file); // $params = new JParameter($content); // Strict standards: Declaration of JParameter::loadSetupFile() should be compatible with that of JRegistry::loadSetupFile() $params = $content; if (!$content instanceof JRegistry) { $params = new JRegistry($content); } $layout = $params->get('desktop_layout', ''); if (T3Common::layout_exists($layout)) { return $layout; } } } // Cannot get from override profile for this page, get from usersetting $layout = T3Parameter::_getParam('layouts', ''); if (T3Common::layout_exists($layout)) { return $layout; } // Get default $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $params = T3Common::get_template_params(); $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } } else { $layout = $params->get($device . '_layout', ''); if (!$layout) { $layout = $params->get('handheld_layout', ''); } if ($layout == -1) { //disable => use layout from desktop $device = ''; $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } elseif ($layout == 1) { //default => use layout from t3 engine $layout = $device; if (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } elseif (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } return $layout; }
function get_active_layout() { //return T3Parameter::_getParam('layouts'); $params = T3Common::get_template_params(); $device = T3Common::mobile_device_detect(); if (!$device) { //desktop //get from override profile $active_profile = T3Common::get_active_profile(); $default_profile = T3Common::get_default_profile(); if ($active_profile != $default_profile && $active_profile != 'default') { $path = 'etc' . DS . 'profiles' . DS . $active_profile . '.ini'; $file = T3Path::path(T3_TEMPLATE_LOCAL) . DS . $path; if (!is_file($file)) { $file = T3Path::path(T3_TEMPLATE_CORE) . DS . $path; } if (is_file($file)) { $content = file_get_contents($file); $params = new JParameter($content); $layout = $params->get('desktop_layout', ''); if (T3Common::layout_exists($layout)) { return $layout; } } } //cannot get from override profile for this page, get from usersetting $layout = T3Parameter::get('layouts', ''); if (T3Common::layout_exists($layout)) { return $layout; } //get default $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } else { $layout = $params->get($device . '_layout', ''); if (!$layout) { $layout = $params->get('handheld_layout', ''); } if ($layout == -1) { //disable => use layout from desktop $device = ''; $layout = $params->get('desktop_layout', ''); if (!T3Common::layout_exists($layout)) { $layout = 'default'; } } else { if ($layout == 1) { //default => use layout from t3 engine $layout = $device; if (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } else { if (!T3Common::layout_exists($layout)) { $layout = 'handheld'; } } } } return $layout; }