This file is part of a Moko Consulting project. SPDX-License-Identifier: GPL-3.0-or-later # FILE INFORMATION DEFGROUP: Joomla.Template.Site INGROUP: Moko-Cassiopeia REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia PATH: ./templates/moko-cassiopeia/index.php VERSION: 03.08.00 BRIEF: Main template index file for Moko-Cassiopeia rendering site layout */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Component\ComponentHelper; /** @var Joomla\CMS\Document\HtmlDocument $this */ $app = Factory::getApplication(); $input = $app->getInput(); $document = $app->getDocument(); $wa = $document->getWebAssetManager(); // Template params $params_LightColorName = (string) $this->params->get('colorLightName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom $params_DarkColorName = (string) $this->params->get('colorDarkName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom $params_googletagmanager = $this->params->get('googletagmanager', false); $params_googletagmanagerid = $this->params->get('googletagmanagerid', null); $params_googleanalytics = $this->params->get('googleanalytics', false); $params_googleanalyticsid = $this->params->get('googleanalyticsid', null); $params_custom_head_start = $this->params->get('custom_head_start', null); $params_custom_head_end = $this->params->get('custom_head_end', null); $params_developmentmode = $this->params->get('developmentmode', false); /* // Bootstrap behaviors (assets handled via WAM) HTMLHelper::_('bootstrap.framework'); HTMLHelper::_('bootstrap.alert'); HTMLHelper::_('bootstrap.button'); HTMLHelper::_('bootstrap.carousel'); HTMLHelper::_('bootstrap.collapse'); HTMLHelper::_('bootstrap.dropdown'); HTMLHelper::_('bootstrap.modal'); HTMLHelper::_('bootstrap.offcanvas'); HTMLHelper::_('bootstrap.popover'); HTMLHelper::_('bootstrap.scrollspy'); HTMLHelper::_('bootstrap.tab'); HTMLHelper::_('bootstrap.tooltip'); HTMLHelper::_('bootstrap.toast'); */ // Detecting Active Variables $option = $input->getCmd('option', ''); $view = $input->getCmd('view', ''); $layout = $input->getCmd('layout', ''); $task = $input->getCmd('task', ''); $itemid = $input->getCmd('Itemid', ''); $sitenameR = $app->get('sitename'); // raw for title composition $sitename = htmlspecialchars($sitenameR, ENT_QUOTES, 'UTF-8'); $menu = $app->getMenu()->getActive(); $pageclass = $menu !== null ? $menu->getParams()->get('pageclass_sfx', '') : ''; // Respect “Site Name in Page Titles” (0:none, 1:before, 2:after) $mode = (int) $app->get('sitename_pagetitles', 0); $pageTitle = trim($this->getTitle()); $final = $pageTitle !== '' ? ($mode === 1 ? $sitenameR . ' - ' . $pageTitle : ($mode === 2 ? $pageTitle . ' - ' . $sitenameR : $pageTitle)) : $sitenameR; $this->setTitle($final); // Template/Media path $templatePath = 'media/templates/site/moko-cassiopeia'; // Core template CSS $wa->useStyle('template.base'); // css/template.css // Color theme (light + optional dark) $colorLightKey = strtolower(preg_replace('/[^a-z0-9_.-]/i', '', $params_LightColorName)); $colorDarkKey = strtolower(preg_replace('/[^a-z0-9_.-]/i', '', $params_DarkColorName)); $lightKey = 'template.light.' . $colorLightKey; $darkKey = 'template.dark.' . $colorDarkKey; try { $wa->useStyle('template.light.colors_standard'); } catch (\Throwable $e) { $wa->registerAndUseStyle('template.light.colors_standard', $templatePath . '/css/global/light/colors_standard.css'); } try { $wa->useStyle('template.dark.colors_standard'); } catch (\Throwable $e) { $wa->registerAndUseStyle('template.dark.colors_standard', $templatePath . '/css/global/dark/colors_standard.css'); } try { $wa->useStyle($lightKey); } catch (\Throwable $e) { $wa->registerAndUseStyle('template.light.dynamic', $templatePath . '/css/global/light/' . $colorLightKey . '.css'); } try { $wa->useStyle($darkKey); } catch (\Throwable $e) { $wa->registerAndUseStyle('template.dark.dynamic', $templatePath . '/css/global/dark/' . $colorDarkKey . '.css'); } // Scripts $wa->useScript('template.js'); /** * VirtueMart detection: * - Component must exist and be enabled */ $isVirtueMartActive = ComponentHelper::isEnabled('com_virtuemart', true); if ($isVirtueMartActive) { /** * Load a VirtueMart-specific stylesheet defined in your template manifest. * This assumes you defined an asset named "template.virtuemart". */ $wa->useStyle('vendor.vm'); } // Font scheme (external or local) + CSS custom properties $params_FontScheme = $this->params->get('useFontScheme', false); $fontStyles = ''; if ($params_FontScheme) { if (stripos($params_FontScheme, 'https://') === 0) { $this->getPreloadManager()->preconnect('https://fonts.googleapis.com/', ['crossorigin' => 'anonymous']); $this->getPreloadManager()->preconnect('https://fonts.gstatic.com/', ['crossorigin' => 'anonymous']); $this->getPreloadManager()->preload($params_FontScheme, ['as' => 'style', 'crossorigin' => 'anonymous']); $wa->registerAndUseStyle('fontscheme.current', $params_FontScheme, [], [ 'media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'', 'crossorigin' => 'anonymous' ]); if (preg_match_all('/family=([^?:]*):/i', $params_FontScheme, $matches) > 0) { $fontStyles = '--font-family-body: "' . str_replace('+', ' ', $matches[1][0]) . '", sans-serif;' . "\n"; $fontStyles .= '--font-family-headings: "' . str_replace('+', ' ', isset($matches[1][1]) ? $matches[1][1] : $matches[1][0]) . '", sans-serif;' . "\n"; $fontStyles .= '--font-weight-normal: 400;' . "\n"; $fontStyles .= '--font-weight-headings: 700;'; } } else { $wa->registerAndUseStyle('fontscheme.current', $params_FontScheme, ['version' => 'auto'], [ 'media' => 'print', 'rel' => 'lazy-stylesheet', 'onload' => 'this.media=\'all\'' ]); $this->getPreloadManager()->preload( $wa->getAsset('style', 'fontscheme.current')->getUri() . '?' . $this->getMediaVersion(), ['as' => 'style'] ); } } // ------------------------------------- // Brand: logo from params OR siteTitle // ------------------------------------- $brandHtml = ''; $logoFile = (string) $this->params->get('logoFile'); if ($logoFile !== '') { $brandHtml = HTMLHelper::_( 'image', Uri::root(false) . htmlspecialchars($logoFile, ENT_QUOTES, 'UTF-8'), $sitename, ['class' => 'logo d-inline-block', 'loading' => 'eager', 'decoding' => 'async'], false, 0 ); } elseif ($this->params->get('siteTitle')) { $brandHtml = '' . htmlspecialchars($this->params->get('siteTitle'), ENT_COMPAT, 'UTF-8') . ''; } else { // Fallback to a bundled image (relative to media paths) $brandHtml = HTMLHelper::_('image', 'full_logo.png', $sitename, ['class' => 'logo d-inline-block', 'loading' => 'eager', 'decoding' => 'async'], true, 0); } // Layout flags $hasClass = ''; if ($this->countModules('sidebar-left', true)) { $hasClass .= ' has-sidebar-left'; } if ($this->countModules('sidebar-right', true)) { $hasClass .= ' has-sidebar-right'; } if ($this->countModules('drawer-left', true)) { $hasClass .= ' has-drawer-left'; } if ($this->countModules('drawer-right', true)) { $hasClass .= ' has-drawer-right'; } // Container $wrapper = $this->params->get('fluidContainer') ? 'wrapper-fluid' : 'wrapper-static'; $stickyHeader = $this->params->get('stickyHeader') ? 'position-sticky sticky-top' : ''; // Meta $this->setMetaData('viewport', 'width=device-width, initial-scale=1'); if ($this->params->get('faKitCode')) { $faKit = "https://kit.fontawesome.com/" . $this->params->get('faKitCode') . ".js"; HTMLHelper::_('script', $faKit, ['crossorigin' => 'anonymous']); } else { try { if($params_developmentmode){ $wa->useStyle('vendor.fa7free.all'); $wa->useStyle('vendor.fa7free.brands'); $wa->useStyle('vendor.fa7free.fontawesome'); $wa->useStyle('vendor.fa7free.regular'); $wa->useStyle('vendor.fa7free.solid'); } else { $wa->useStyle('vendor.fa7free.all.min'); $wa->useStyle('vendor.fa7free.brands.min'); $wa->useStyle('vendor.fa7free.fontawesome.min'); $wa->useStyle('vendor.fa7free.regular.min'); $wa->useStyle('vendor.fa7free.solid.min'); } } catch (\Throwable $e) { if($params_developmentmode){ $wa->registerAndUseStyle('vendor.fa7free.all.dynamic', $templatePath . '/vendor/fa7free/css/all.css'); $wa->registerAndUseStyle('vendor.fa7free.brands.dynamic', $templatePath . '/vendor/fa7free/css/brands.css'); $wa->registerAndUseStyle('vendor.fa7free.fontawesome.dynamic', $templatePath . '/vendor/fa7free/css/fontawesome.css'); $wa->registerAndUseStyle('vendor.fa7free.regular.dynamic', $templatePath . '/vendor/fa7free/css/regular.css'); $wa->registerAndUseStyle('vendor.fa7free.solid.dynamic', $templatePath . '/vendor/fa7free/css/solid.css'); } else { $wa->registerAndUseStyle('vendor.fa7free.all.min.dynamic', $templatePath . '/vendor/fa7free/css/all.min.css'); $wa->registerAndUseStyle('vendor.fa7free.brands.min.dynamic', $templatePath . '/vendor/fa7free/css/brands.min.css'); $wa->registerAndUseStyle('vendor.fa7free.fontawesome.min.dynamic', $templatePath . '/vendor/fa7free/css/fontawesome.min.css'); $wa->registerAndUseStyle('vendor.fa7free.regular.min.dynamic', $templatePath . '/vendor/fa7free/css/regular.min.css'); $wa->registerAndUseStyle('vendor.fa7free.solid.min.dynamic', $templatePath . '/vendor/fa7free/css/solid.min.css'); } } } $params_leftIcon = htmlspecialchars($this->params->get('drawerLeftIcon', 'fa-solid fa-chevron-left'), ENT_COMPAT, 'UTF-8'); $params_rightIcon = htmlspecialchars($this->params->get('drawerRightIcon', 'fa-solid fa-chevron-right'), ENT_COMPAT, 'UTF-8'); $wa->useStyle('template.user'); // css/user.css ?>
countModules('topbar')) : ?>
countModules('below-topbar')) : ?>
params->get('brand', 1)) : ?>
params->get('siteDescription')) : ?>
params->get('siteDescription'), ENT_QUOTES, 'UTF-8'); ?>
countModules('below-logo')) : ?>
countModules('drawer-left')) : ?> countModules('drawer-right')) : ?> countModules('menu', true) || $this->countModules('search', true)) : ?>
countModules('menu', true)) : ?>
countModules('search', true)) : ?>
countModules('banner', true)) : ?>
countModules('top-a', true)) : ?>
countModules('top-b', true)) : ?>
countModules('sidebar-left', true)) : ?>
countModules('sidebar-right', true)) : ?>
countModules('bottom-a', true)) : ?>
countModules('bottom-b', true)) : ?>
countModules('footer-menu', true)) : ?>
countModules('footer', true)) : ?>
params->get('backTop') == 1) : ?> countModules('drawer-left', true)) : ?>
countModules('drawer-right', true)) : ?>