Files
MokoJoomHero/src/index.php
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

183 lines
5.7 KiB
PHP
Raw Normal View History

<?php
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
*
* This file is part of a Moko Consulting project.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* FILE INFORMATION
* DEFGROUP: MokoJoomHero.Template
* INGROUP: MokoJoomHero
* REPO: https://github.com/mokoconsulting-tech/MokoJoomHero
* PATH: /src/index.php
* VERSION: 01.00.01
* BRIEF: Main template entry point — renders the full HTML page
*/
defined('_JEXEC') or die;
use Joomla\CMS\Document\HtmlDocument;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
/** @var HtmlDocument $this */
$app = Factory::getApplication();
$wa = $this->getWebAssetManager();
$params = $app->getTemplate(true)->params;
// Register and use template assets via Web Asset Manager
$wa->usePreset('template.tpl_mokojoomhero');
// Template parameters
$logo = $params->get('logoFile', '');
$site_description = $params->get('siteDescription', '');
$brand_color = $params->get('brandColor', '#1a73e8');
$fluid = (bool) $params->get('fluidContainer', 0);
$sticky_header = (bool) $params->get('stickyHeader', 1);
$back_to_top = (bool) $params->get('backToTop', 1);
$container_class = $fluid ? 'container-fluid' : 'container';
// Inject brand color as CSS custom property
$this->addHeadStyle(':root { --brand-color: ' . htmlspecialchars($brand_color, ENT_QUOTES, 'UTF-8') . '; }');
?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<jdoc:include type="metas" />
<jdoc:include type="styles" />
<jdoc:include type="scripts" />
</head>
<body class="site <?php echo $this->direction === 'rtl' ? 'rtl' : 'ltr'; ?>">
<?php // Topbar position ?>
<?php if ($this->countModules('topbar')) : ?>
<div class="topbar">
<div class="<?php echo $container_class; ?>">
<jdoc:include type="modules" name="topbar" style="none" />
</div>
</div>
<?php endif; ?>
<?php // Header ?>
<header class="site-header<?php echo $sticky_header ? ' sticky-header' : ''; ?>">
<div class="<?php echo $container_class; ?>">
<div class="header-inner">
<?php // Site branding ?>
<div class="site-brand">
<a href="<?php echo Uri::base(); ?>">
<?php if ($logo) : ?>
<img src="<?php echo htmlspecialchars($logo, ENT_QUOTES, 'UTF-8'); ?>"
alt="<?php echo htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8'); ?>"
class="site-logo" />
<?php else : ?>
<span class="site-title"><?php echo htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8'); ?></span>
<?php endif; ?>
</a>
<?php if ($site_description) : ?>
<p class="site-description"><?php echo htmlspecialchars($site_description, ENT_QUOTES, 'UTF-8'); ?></p>
<?php endif; ?>
</div>
<?php // Navigation ?>
<?php if ($this->countModules('menu')) : ?>
<nav class="site-navigation" aria-label="<?php echo Text::_('TPL_MOKOJOOMHERO_MAIN_NAV'); ?>">
<jdoc:include type="modules" name="menu" style="none" />
</nav>
<?php endif; ?>
</div>
</div>
</header>
<?php // Banner ?>
<?php if ($this->countModules('banner')) : ?>
<div class="banner-area">
<jdoc:include type="modules" name="banner" style="none" />
</div>
<?php endif; ?>
<?php // Hero section ?>
<?php if ($this->countModules('hero')) : ?>
<section class="hero-section">
<div class="<?php echo $container_class; ?>">
<jdoc:include type="modules" name="hero" style="hero" />
</div>
</section>
<?php endif; ?>
<?php // Breadcrumbs ?>
<?php if ($this->countModules('breadcrumbs')) : ?>
<div class="breadcrumbs-area">
<div class="<?php echo $container_class; ?>">
<jdoc:include type="modules" name="breadcrumbs" style="none" />
</div>
</div>
<?php endif; ?>
<?php // Main content area ?>
<main class="site-main">
<div class="<?php echo $container_class; ?>">
<?php if ($this->countModules('main-top')) : ?>
<div class="main-top">
<jdoc:include type="modules" name="main-top" style="card" />
</div>
<?php endif; ?>
<div class="content-area">
<?php // Sidebar left ?>
<?php if ($this->countModules('sidebar-left')) : ?>
<aside class="sidebar sidebar-left" role="complementary">
<jdoc:include type="modules" name="sidebar-left" style="card" />
</aside>
<?php endif; ?>
<?php // Component output ?>
<div class="content-body">
<jdoc:include type="message" />
<jdoc:include type="component" />
</div>
<?php // Sidebar right ?>
<?php if ($this->countModules('sidebar-right')) : ?>
<aside class="sidebar sidebar-right" role="complementary">
<jdoc:include type="modules" name="sidebar-right" style="card" />
</aside>
<?php endif; ?>
</div>
<?php if ($this->countModules('main-bottom')) : ?>
<div class="main-bottom">
<jdoc:include type="modules" name="main-bottom" style="card" />
</div>
<?php endif; ?>
</div>
</main>
<?php // Footer ?>
<footer class="site-footer">
<div class="<?php echo $container_class; ?>">
<?php if ($this->countModules('footer')) : ?>
<jdoc:include type="modules" name="footer" style="none" />
<?php endif; ?>
<div class="footer-copyright">
<p>&copy; <?php echo date('Y'); ?> <?php echo htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8'); ?></p>
</div>
</div>
</footer>
<?php // Back to top button ?>
<?php if ($back_to_top) : ?>
<a href="#" class="back-to-top" aria-label="<?php echo Text::_('TPL_MOKOJOOMHERO_BACK_TO_TOP'); ?>">
<span aria-hidden="true">&uarr;</span>
</a>
<?php endif; ?>
<?php // Debug position ?>
<jdoc:include type="modules" name="debug" style="none" />
</body>
</html>