Migrate the template to Joomla 4 #1

Merged
christian merged 13 commits from dev/j4-compatibility into master 2022-04-09 14:57:52 +00:00
2 changed files with 17 additions and 193 deletions
Showing only changes of commit bb7365409a - Show all commits

View File

@ -5,10 +5,11 @@ define('JPATH_BASE', '../../../');
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );
/* Create the Application */
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$params = JFactory::getApplication()->getTemplate(true)->params;
$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");
@ -24,8 +25,6 @@ header("Cache-Control: must-revalidate, max-age=$offset, public");
$leftImageValue = (empty($params['imgleft']) ? "none" : "url(\"" . JPATH_BASE. "/" . $params['imgleft'] . "\")") ;
$rightImageValue = (empty($params['imgright']) ? "none" : "url(\"" . JPATH_BASE . "/" . $params['imgright'] . "\")")
// $leftImageValue = (empty($params['imgleft']) ? "none" : "url(\"" . $this->baseurl . "/" . $params['imgleft'] . "\")") ;
// $rightImageValue = (empty($params['imgright']) ? "none" : "url(\"" . $this->baseurl . "/" . $params['imgright'] . "\")")
?>
@ -67,7 +66,7 @@ a, a:hover, a:active, a:visited
color: <?php echo $params['licolor3']; ?>;
}
ul.menu {
ul.mod-menu {
background-color: <?php echo $params['bgcolor1']; ?>;
color: <?php echo $params['fgcolor1']; ?>;
}
@ -77,8 +76,8 @@ ul.menu {
color: <?php echo $params['fgcolor1']; ?>;
}
ul.menu li.current > a,
ul.menu li.current:hover > a
ul.mod-menu li.current > a,
ul.mod-menu li.current:hover > a
{
background-color: <?php echo $params['bgcolor2']; ?>;
color: <?php echo $params['licolor2']; ?>;
@ -86,27 +85,27 @@ ul.menu li.current:hover > a
ul.nav > li > a:hover,
ul.nav > li > a:focus,
ul.nav-child > li > a:hover,
ul.nav-child > li > a:focus
ul.mod-menu__sub > li > a:hover,
ul.mod-menu__sub > li > a:focus
{
background-color: <?php echo $params['bgcolor3']; ?>;
color: <?php echo $params['licolor3']; ?>;
}
#topmenu,
#topmenu > ul.menu {
#topmenu > ul.mod-menu {
background-color: <?php echo $params['topbgcolor1']; ?>;
color: <?php echo $params['topfgcolor1']; ?>;
}
#topmenu .nav-child > li.current
#topmenu .mod-menu__sub > li.current
{
background-color: <?php echo $params['topbgcolor2']; ?>;
color: <?php echo $params['topfgcolor2']; ?>;
}
#topmenu .nav-child {
#topmenu .mod-menu__sub {
background-color: <?php echo $params['topbgcolor3']; ?>;
color: <?php echo $params['topfgcolor3']; ?>;
}
@ -114,8 +113,8 @@ ul.nav-child > li > a:focus
#topmenu .nav > li:hover,
#topmenu .nav > li:focus,
#topmenu .nav > li.active,
#topmenu .nav-child > li:hover,
#topmenu .nav-child > li:focus
#topmenu .mod-menu__sub > li:hover,
#topmenu .mod-menu__sub > li:focus
{
background-color: <?php echo $params['topbgcolor2']; ?>;
color: <?php echo $params['topfgcolor2']; ?>;

View File

@ -15,20 +15,12 @@ JHtml::_('bootstrap.loadCss', true, $this->direction);
// Add jQuery framework
JHtml::_('jquery.framework');
// Add template js
//JHtml::_('script', 'template.js', array('version' => 'auto', 'relative' => true));
// Add html5 shiv
//JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9'));
// Add Stylesheets
JHtml::_('stylesheet', 'templates/system/css/system.css', array('version' => 'auto', 'relative' => false));
// JHtml::_('stylesheet', 'media/jui/css/icomoon.css', array('version' => 'auto', 'relative' => false));
JHtml::_('stylesheet', 'style.css', array('version' => 'auto', 'relative' => true));
$doc->addStyleSheet($this->baseurl.'/media/jui/css/icomoon.css');
$doc->addStyleSheet($this->baseurl.'/media/system/css/joomla-fontawesome.css');
// $doc->addStyleSheet($this->baseurl.'/templates/slt/css/dynamic-styles.css.php?Itemid=' . $app->input->getInt('Itemid'));
$doc->addStyleSheet($this->baseurl.'/templates/slt/css/dynamic-styles.css.php?Itemid=' . $app->input->getInt('Itemid'));
// Add Javascript for mobile menu
JHtml::_('script', 'mobile.js', array('version' => 'auto', 'relative' => true));
@ -39,11 +31,6 @@ JHtml::_('stylesheet', 'user.css', array('version' => 'auto', 'relative' => true
// Check for a custom js file
JHtml::_('script', 'user.js', array('version' => 'auto', 'relative' => true));
$params = JFactory::getApplication()->getTemplate(true)->params;
$leftImageValue = (empty($params['imgleft']) ? "none" : "url(\"" . JPATH_BASE. "/" . $params['imgleft'] . "\")") ;
$rightImageValue = (empty($params['imgright']) ? "none" : "url(\"" . JPATH_BASE . "/" . $params['imgright'] . "\")")
?>
<?php echo '<!DOCTYPE html>'; ?>
@ -52,169 +39,7 @@ $rightImageValue = (empty($params['imgright']) ? "none" : "url(\"" . JPATH_BASE
<head>
<jdoc:include type="head" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
<?php
if($params['titlepage'] === '1')
{
?>
#left-menu
{
display: none;
}
<?php
}
?>
body
{
background-color: <?php echo $params['bgcolorside']; ?>;
}
a, a:hover, a:active, a:visited
{
color: <?php echo $params['mainlicolor']; ?>;
}
#page-bg
{
background-image: linear-gradient(to bottom, <?php echo $params['mainbgcolortop'] . ',' . $params['mainbgcolorbot']; ?>);
color: <?php echo $params['mainfgcolor']; ?>;
}
#mobile-menu li > a {
background-color: <?php echo $params['bgcolor2']; ?>;
color: <?php echo $params['licolor2']; ?>;
}
#mobile-menu li.current > a {
background-color: <?php echo $params['bgcolor3']; ?>;
color: <?php echo $params['licolor3']; ?>;
}
ul.mod-menu {
background-color: <?php echo $params['bgcolor1']; ?>;
color: <?php echo $params['fgcolor1']; ?>;
}
#mobile-menu {
background-color: <?php echo $params['bgcolor1']; ?>;
color: <?php echo $params['fgcolor1']; ?>;
}
ul.mod-menu li.current > a,
ul.mod-menu li.current:hover > a
{
background-color: <?php echo $params['bgcolor2']; ?>;
color: <?php echo $params['licolor2']; ?>;
}
ul.nav > li > a:hover,
ul.nav > li > a:focus,
ul.mod-menu__sub > li > a:hover,
ul.mod-menu__sub > li > a:focus
{
background-color: <?php echo $params['bgcolor3']; ?>;
color: <?php echo $params['licolor3']; ?>;
}
#topmenu,
#topmenu > ul.mod-menu {
background-color: <?php echo $params['topbgcolor1']; ?>;
color: <?php echo $params['topfgcolor1']; ?>;
}
#topmenu .mod-menu__sub > li.current
{
background-color: <?php echo $params['topbgcolor2']; ?>;
color: <?php echo $params['topfgcolor2']; ?>;
}
#topmenu .mod-menu__sub {
background-color: <?php echo $params['topbgcolor3']; ?>;
color: <?php echo $params['topfgcolor3']; ?>;
}
#topmenu .nav > li:hover,
#topmenu .nav > li:focus,
#topmenu .nav > li.active,
#topmenu .mod-menu__sub > li:hover,
#topmenu .mod-menu__sub > li:focus
{
background-color: <?php echo $params['topbgcolor2']; ?>;
color: <?php echo $params['topfgcolor2']; ?>;
}
#left-side-image
{
background-image: <?php echo $leftImageValue; ?>;
}
#right-side-image
{
background-image: <?php echo $rightImageValue; ?>;
}
.list-striped li:nth-child(odd),
.row-striped .row-fluid:nth-child(odd),
.table-striped > tbody > tr:nth-child(odd)
{
background-color: <?php echo $params['bgcolor2']; ?>;
color: <?php echo $params['fgcolor2']; ?>;
}
.row-striped .row-fluid:nth-child(odd) a,
.table-striped > tbody > tr:nth-child(odd) a
{
color: <?php echo $params['licolor2']; ?>;
}
.list-striped li:hover,
.row-striped .row-fluid:hover,
.table-striped > tbody > tr:hover
{
background-color: <?php echo $params['bgcolor3']; ?>;
color: <?php echo $params['fgcolor3']; ?>;
}
.row-striped .row-fluid:hover a,
.table-striped > tbody > tr:hover a
{
color: <?php echo $params['licolor3']; ?>;
}
.table-striped > thead > tr
{
background-color: <?php echo $params['bgcolor3']; ?>;
color: <?php echo $params['fgcolor3']; ?>;
}
table.alternating tr:nth-child(even) {
background-color: <?php echo $params['bgcolor2']; ?>;
color: <?php echo $params['fgcolor2']; ?>;
}
table.alternating tr:nth-child(even) a
{
color: <?php echo $params['licolor2']; ?>;
}
table.alternating tr:nth-child(1) {
background-color: <?php echo $params['bgcolor3']; ?>;
color: <?php echo $params['fgcolor3']; ?>;
}
table.alternating tr:nth-child(1) a {
color: <?php echo $params['licolor3']; ?>;
}
.readmore > .btn
{
color: <?php echo $params['fgcolor1'];?>;
background-color: <?php echo $params['bgcolor1']; ?>;
}
.readmore > .btn:hover
{
color: <?php echo $params['fgcolor3'];?>;
background-color: <?php echo $params['bgcolor3']; ?>;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>