public static function getLayoutPath($type, $name, $client = 'site', $layout = 'default', $viewName = null) { $defaultLayout = $layout; if ($client == 'site' && $viewName && !empty($viewName)) { $_template = TZ_Portfolio_PlusTemplate::getTemplate(true); $template = $_template->template; $params = $_template->params; if (strpos($layout, ':') !== false) { // Get the template and file name from the string $temp = explode(':', $layout); $template = $temp[0] == '_' ? $_template->template : $temp[0]; $layout = $temp[1]; $defaultLayout = $temp[1] ? $temp[1] : 'default'; } self::$layout = $defaultLayout; // Build the template and base path for the layout $tPath = COM_TZ_PORTFOLIO_PLUS_TEMPLATE_PATH . '/' . $template . '/html/' . $params->get('layout', 'default') . '/' . $viewName . '/plg_' . $type . '_' . $name . '/' . $layout . '.php'; $bPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/views' . '/' . $viewName . '/tmpl' . '/' . $defaultLayout . '.php'; $dPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/views' . '/' . $viewName . '/tmpl' . '/default.php'; } elseif ($client == 'admin') { $template = JFactory::getApplication()->getTemplate(); if (strpos($layout, ':') !== false) { // Get the template and file name from the string $temp = explode(':', $layout); $template = $temp[0] == '_' ? $template : $temp[0]; $layout = $temp[1]; $defaultLayout = $temp[1] ? $temp[1] : 'default'; } // Build the template and base path for the layout $tPath = JPATH_THEMES . '/' . $template . '/html/plg_' . $type . '_' . $name . '/' . $layout . '.php'; $bPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/tmpl/' . $defaultLayout . '.php'; $dPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/tmpl/default.php'; } // If the template has a layout override use it if (file_exists($tPath)) { return $tPath; } elseif (file_exists($bPath)) { return $bPath; } else { return $dPath; } }