template/slt/css/dynamic-styles.css.php

78 lines
2.6 KiB
PHP

<?php
define('_JEXEC', 1);
define('JPATH_BASE', '../../../');
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';
$container = \Joomla\CMS\Factory::getContainer();
$container->alias(\Joomla\Session\SessionInterface::class, 'session.web.site');
$mainframe = $container->get(\Joomla\CMS\Application\SiteApplication::class);
$template = $mainframe->getTemplate(true);
$params = $template->params;
header('content-type: text/css');
// duration of cached content (1 hour)
$offset = 60 * 60;
// cache control to process
header("Cache-Control: must-revalidate, max-age=$offset, public");
// expiration header format
// $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s",time() + $offset) . " GMT";
// send cache expiration header to broswer
// header($ExpStr);
$leftImageValue = empty($params['imgleft'])
? 'none'
: "url(\"" . JPATH_BASE . $params['imgleft'] . "\")";
$rightImageValue = empty($params['imgright'])
? 'none'
: "url(\"" . JPATH_BASE . $params['imgright'] . "\")";
?>
<?php if ($params['titlepage'] === '1') {
echo "#left-menu { display: none; }\n";
} ?>
:root {
--color-fg-top: <?php echo $params['topfgcolor1']; ?>;
--color-bg-top: <?php echo $params['topbgcolor1']; ?>;
--color-fg-top-dark: <?php echo $params['topfgcolor2']; ?>;
--color-bg-top-dark: <?php echo $params['topbgcolor2']; ?>;
--color-fg-top-light: <?php echo $params['topfgcolor3']; ?>;
--color-bg-top-light: <?php echo $params['topbgcolor3']; ?>;
--color-main: <?php echo $params['mainfgcolor']; ?>;
--color-main-link: <?php echo $params['mainlicolor']; ?>;
--color-header-link: <?php echo $params['headercolor']; ?>;
--color-page-bg-top: <?php echo $params['mainbgcolortop']; ?>;
--color-page-bg-bottom: <?php echo $params['mainbgcolorbot']; ?>;
--color-menu: <?php echo $params['fgcolor1']; ?>;
--color-menu-background: <?php echo $params['bgcolor1']; ?>;
--color-menu-active: <?php echo $params['fgcolor2']; ?>;
--color-menu-background-active: <?php echo $params['bgcolor2']; ?>;
--color-effect: <?php echo $params['fgeffect']; ?>;
--color-effect-background: <?php echo $params['bgeffect']; ?>;
--color-effect-header: <?php echo $params['fgeffecthdr']; ?>;
--color-effect-background-header: <?php echo $params['bgeffecthdr']; ?>;
--color-side-background: <?php echo $params['bgcolorside']; ?>;
--image-left-side: <?php echo $leftImageValue; ?>;
--image-right-side: <?php echo $rightImageValue; ?>;
}
<?php // Stop execution here, the rest is for debugging
exit(); ?>
:root {
--color-effect: blue;
--color-effect-background: red;
--color-effect-header: yellow;
--color-effect-background-header: green;
}