Загрузка данных


<?php
defined('_JEXEC') or die('Restricted access');
?>
<!DOCTYPE html>
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>">
<head>
    <!-- ========== META ========== -->
    <meta property="og:site_name" content="ProBelarus.by" />
    <meta property="og:url" content="<?php echo JUri::getInstance()->toString(); ?>" />

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="HandheldFriendly" content="True" />
    <meta name="yandex-verification" content="0493cc8b20c75fcd" />
    <meta name="cmsmagazine" content="b4e3f2c21635c60d26cb2470c2c31cd6" />
    <meta name="robots" content="max-image-preview:large" />
    <meta name="facebook-domain-verification" content="zg3ejyeia4kz823wafdqvwz02zrnn7" />
    <meta name="zen-verification" content="XT7kDb1qKfAY77FTjSg448Q0AoAVL9DneyDQCriaeonytrNIRvT0wK7uCCZiChjX" />

    <!-- ========== GOOGLE ANALYTICS ========== -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-T016GSDKJL"></script>
    <script>
        window.dataLayer = window.dataLayer || [];

        function gtag() {
            dataLayer.push(arguments);
        }
        gtag('js', new Date());
        gtag('config', 'G-T016GSDKJL');
    </script>

    <!-- ========== PHP VARIABLES ========== -->
    <?php
    $app      = JFactory::getApplication();
    $template = $app->getTemplate(true);
    $doc      = JFactory::getDocument();
    $sitename = $app->get('sitename');

    // Получаем и чистим заголовок
    $thislinktitle = $doc->getTitle();
    $thislinktitle = str_ireplace(' | ProBelarus.by', '', $thislinktitle);

    // Определяем классы для страницы
    $itemid = $app->input->getCmd('Itemid', '');
    if ($this->countmodules('user4')) {
        $itemid = 235;
    }
    $insideclass = ($itemid != 235) ? ' class="insidepage"' : ' class="mainpagecontent"';

    $option       = $app->input->get('option');
    $view         = $app->input->get('view');
    $active_catid = $app->input->getInt('id');

    // Проверяем, показывать ли левую колонку
    $countmodulesleft = '';
    if (!($option === 'com_content' && $view === 'category' && in_array($active_catid, [303, 375, 290]))) {
        $countmodulesleft = $this->countmodules('left');
    }

    // ========== ОТКЛЮЧАЕМ СТАНДАРТНЫЙ BOOTSTRAP ==========
    unset($doc->_scripts[$this->baseurl . '/media/jui/js/bootstrap.min.js']);
    unset($doc->_styleSheets[$this->baseurl . '/media/jui/css/bootstrap.min.css']);

    // ========== ПОДКЛЮЧАЕМ СВОИ CSS (ПРАВИЛЬНЫЙ ПОРЯДОК) ==========
    $doc->addStyleSheet('templates/probel/css/bootstrap.min.css');
    $doc->addStyleSheet('templates/probel/css/header.css');
    $doc->addStyleSheet('templates/probel/css/style.css');
    $doc->addStyleSheet('templates/probel/css/menu.css');
    $doc->addStyleSheet('templates/probel/css/blog-cards.css');
    $doc->addStyleSheet('templates/probel/css/afisha-cards.css');

    // ========== ОТКЛЮЧАЕМ ГЕНЕРАТОР ==========
    $this->setGenerator(null);

    // ========== FAVICON ==========
    $doc->addFavicon('templates/probel/favicon.png', 'image/png', 'shortcut icon');
    ?>
    <link rel="icon" sizes="120x120" href="templates/probel/favicon120.png" />
    <link rel="apple-touch-icon" sizes="120x120" href="templates/probel/favicon120.png" />


<!-- ========== VIEWED ITEMS (LOCALSTORAGE) ========== -->
<?php
// Получаем заголовок страницы и убираем суффикс
$cleanTitle = $doc->getTitle();
$cleanTitle = str_ireplace([' | ProBelarus.by', ' - ProBelarus.by'], '', $cleanTitle);
?>
<script>
// Получаем массив просмотренных страниц
let viewedItems = JSON.parse(localStorage.getItem('viewedItems')) || [];

// Формируем ссылку для текущей страницы с чистым заголовком
const currentItemId = '<a href="' + location.href + '"><?php echo addslashes($cleanTitle); ?></a>';

// Удаляем дубликат, если есть
let index = viewedItems.indexOf(currentItemId);
if (index !== -1) {
    viewedItems.splice(index, 1);
}

// Добавляем в начало
viewedItems.unshift(currentItemId);

// Оставляем только последние 10
viewedItems = viewedItems.slice(0, 10);

// Сохраняем в localStorage
localStorage.setItem('viewedItems', JSON.stringify(viewedItems));
</script>
      
      

    <!-- ========== JOOOMLA HEAD ========== -->
    <jdoc:include type="head" />
      

    <!-- ========== YANDEX METRIKA ========== -->
    <script type="text/javascript">
        (function(m, e, t, r, i, k, a) {
            m[i] = m[i] || function() {
                (m[i].a = m[i].a || []).push(arguments);
            };
            m[i].l = 1 * new Date();
            for (var j = 0; j < document.scripts.length; j++) {
                if (document.scripts[j].src === r) {
                    return;
                }
            }
            k = e.createElement(t), a = e.getElementsByTagName(t)[0], k.async = 1, k.src = r, a.parentNode.insertBefore(
            k, a);
        })(window, document, 'script', 'https://mc.yandex.ru/metrika/tag.js', 'ym');

        ym(26130090, 'init', {
            webvisor: true,
            clickmap: true,
            ecommerce: "dataLayer",
            referrer: document.referrer,
            url: location.href,
            accurateTrackBounce: true,
            trackLinks: true
        });
    </script>
    <noscript>
        <div><img src="https://mc.yandex.ru/watch/26130090" style="position:absolute; left:-9999px;" alt="" /></div>
    </noscript>

    <!-- ========== YANDEX METRIKA: READ FINISH GOAL ========== -->
    <script>
        window.addEventListener('scroll', function() {
            var scrollHeight = document.documentElement.scrollHeight;
            var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
            var clientHeight = document.documentElement.clientHeight;

            if (scrollTop + clientHeight >= scrollHeight * 0.9) {
                if (!window.readFinishSent) {
                    ym(26130090, 'reachGoal', 'read_finish');
                    window.readFinishSent = true;
                    console.log('Цель read_finish отправлена!');
                }
            }
        });
    </script>

</head>


<body <?php echo $insideclass;?>>
<jdoc:include type="modules" name="banner-1" style="xhtml"/>
<?php if($this->countmodules('reklamny-blok-verh')) { ?> 
<div class="topadsblock" style="background: #fff;">
<div class="container">
<div class="row">
<div class="col-md-12">
<jdoc:include type="modules" name="reklamny-blok-verh"/>
</div></div></div></div>
<?php } ?>

<header class="header">
<div class="topline">
<div class="container">

<div class="row">
 <div class="col-md-3 col-sm-4 col-xs-6">

 	<div class="logo">
 	<a href="<?php echo $this->baseurl; ?>"><img src="templates/probel/images/logo.png" alt=""></a>
 	<span class="nosticky nomobile hidden-sm"><?php echo $template->params->get('slogan', '');?></span>
 	</div>
 </div>
<div class="col-md-9 col-sm-8 col-xs-6">
<jdoc:include type="modules" name="header"/>
</div>
</div>
</div> 
</div> 
	
            <div class="header-top sticky-header">
                <div class="container">

                    <div class="row">
                        <div class="col-md-12 hidden-sm hidden-xs">
                            <div class="mgea-full-width">
                                <div class="header-menu">
								
                                    <nav>
                                        <jdoc:include type="modules" name="top"/>	
                                    </nav>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="mobile-menu-area hidden-lg hidden-md">
                    <div class="container">
                        <div class="col-md-12">
								<jdoc:include type="modules" name="topline"/>
                            <nav id="dropdown">
                              <jdoc:include type="modules" name="top"/>	
                            </nav>
                        </div>
                    </div>
                </div> 
            </div>

</header>



<?php if($this->countmodules('user4')) { ?> 
<jdoc:include type="modules" name="user4" style="xhtml"/>
<?php } ?>


<jdoc:include type="modules" name="flats1" style="xhtml"/>




<div class="container">
<div class="mainpagecontentwrap">
<jdoc:include type="modules" name="user1" style="xhtml"/>
<?php if($this->countmodules('position-1')) { ?> 
<div class="row hidden-xs">
<div class="col-md-12">
<jdoc:include type="modules" name="position-1" style="xhtml"/>	
</div></div>
<?php } ?>


<div class="row">
<?php if($this->countmodules('position-2')) { ?> 
<div class="col-md-<?php 
if($this->countmodules('position-3') && $this->countmodules('position-3-1')) echo '6'; 
elseif($this->countmodules('position-3') || $this->countmodules('position-3-1')) echo '9'; 
else echo '12'; ?> ">
<jdoc:include type="modules" name="position-2" style="xhtml"/>	
</div>
<?php } ?>
<?php if($this->countmodules('position-3')) { ?> 
<div class="col-md-3">
<jdoc:include type="modules" name="position-3" style="xhtml"/>	
</div>
<?php } ?>
<?php if($this->countmodules('position-3-1')) { ?> 
<div class="col-md-3">
<jdoc:include type="modules" name="position-3-1" style="xhtml"/>	
</div>
<?php } ?>
</div>

<div class="row">
<div class="col-sm-12">
<jdoc:include type="message" />

<?php 
jimport('joomla.application.module.helper');
$modules = JModuleHelper::getModules('banner-2');
foreach ($modules as $module) {
	$params = json_decode($module->params);
	$cat = $params->catid[0];
	$limit = $params->count;

JModelLegacy::addIncludePath(JPATH_ROOT . '/components/com_banners/models', 'BannersModel');
JLoader::register('BannerHelper', JPATH_ROOT . '/components/com_banners/helpers/banner.php');

		$model = JModelLegacy::getInstance('Banners', 'BannersModel', array('ignore_request' => true));
		$model->setState('filter.client_id', 0);
		$model->setState('filter.category_id', $cat);
		$model->setState('list.limit', $limit);
		$model->setState('list.start', 0);
		$model->setState('filter.ordering', 'random');
		$banners = $model->getItems();	
		
if ($banners){
	$model->impress();
	if(isset($banners[0]) && !empty($banners[0])){
$this->banner = $banners[0];		
include('templates/probel/html/com_content/category/blog_banners.php');
}	
}
}
?>
</div>
</div>
<?php if($this->countmodules('position-4')) { ?> 
<div class="row hidden-xs hidden-sm">
<div class="col-md-12">
<jdoc:include type="modules" name="position-4" style="xhtml"/>	
</div>
</div>
<?php } ?>
 

<?php if ($this->countModules('position-4-1')) : ?>
<div class="row">
    <jdoc:include type="modules" name="position-4-1" style="xhtml" />
</div>
<?php endif; ?>
  
<div class="row ">
<div class="leftside hidden-sm hidden-xs <?php if($countmodulesleft) echo 'col-md-3'; else echo 'hidden-md hidden-lg';?>">
<jdoc:include type="modules" name="left" style="xhtml"/>
<jdoc:include type="modules" name="banner-3" style="xhtml"/>	
</div>
<div class="col-sm-12 <?php if($countmodulesleft) echo 'col-md-9';?> col-xs-12">
<jdoc:include type="component" />
<div class="posafish">
<jdoc:include type="modules" name="position-15" style="xhtml"/>	
</div>
</div>
</div>
<?php if($this->countmodules('position-20')) { ?> 
<div class="row">
<jdoc:include type="modules" name="position-20" style="xhtml"/>	
</div>
<?php } ?>
<?php 
if(isset($banners[1]) && !empty($banners[1])){
$this->banner = $banners[1];		
include('templates/probel/html/com_content/category/blog_banners.php');
}	
?>
<?php if($this->countmodules('position-5')) { ?> 
<div class="row">
<jdoc:include type="modules" name="position-5" style="xhtml"/>	
</div>
<?php } ?>



<div class="row hidden-lg hidden-md">
<?php if($this->countmodules('position-4')) { ?> 
<div class="col-md-12">
<jdoc:include type="modules" name="position-4" style="xhtml"/>	
</div>
<?php } ?>
</div>
</div>
  
</div> <!-- ЗАКРЫВАЕМ ГЛОБАЛЬНЫЙ .container ТУТ, чтобы выпустить подвалы на всю ширину экрана -->

<!-- СЕРЫЙ ПОДВАЛ 1 (На всю ширину экрана) -->
<div class="greywrapper">
	<div class="container">
        <div id="viewed-items-list" class="moduletable col-sm-12"></div>
  		<div style="clear: both;"></div>
  		<hr>
        <div class="row">
            <div class="col-md-3 col-sm-6">
                <jdoc:include type="modules" name="position-10" style="xhtml"/>	
            </div>
            <div class="col-md-3 col-sm-6">
                <jdoc:include type="modules" name="footer-catalog" style="xhtml"/>	
            </div>
            <div class="col-md-3 col-sm-6">
                <jdoc:include type="modules" name="position-14" style="xhtml"/>	
            </div>
            <div class="col-md-3 col-sm-6">
                <jdoc:include type="modules" name="position-12" style="xhtml"/>	
            </div>
        </div>
	</div>
   <div style="clear: both;"></div><br>
</div>

<!-- Оставляем вывод остальных модулей, если они нужны -->
<jdoc:include type="modules" name="user2" style="xhtml"/>
<jdoc:include type="modules" name="bottomleft" style="xhtml" />

<footer id="footer">
<div class="footer-container">
<div class="footer-content">
<div class="container">

<jdoc:include type="modules" name="footer" />
<div class="row footerRow">
<div class="col-md-3 col-sm-6">
    <!-- Первая колонка: Блок логотипа -->
    <img src="templates/probel/images/logo-PB-footer-w.png" class="flogo" />
    
    <!-- Сюда переезжает модуль с социальными сетями -->
    <div class="footer-social-under-logo">
        <jdoc:include type="modules" name="footer-social" />
    </div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
    <jdoc:include type="modules" name="footer1" />
</div>
<div class="col-md-3 col-sm-6">
    <jdoc:include type="modules" name="footer2" />
</div>
<div class="col-md-3 col-sm-5 col-xs-12">
    <!-- Четвертая колонка: здесь остаются только платежные системы -->
    <jdoc:include type="modules" name="footer3" />
</div>
</div>
							
</div>
</div>
</div>
</footer>


<script src="templates/probel/js/bootstrap.min.js"></script>
<script src="templates/probel/js/plugins.js"></script>
<script src="templates/probel/js/main.js"></script>

<script>
    let jsScripts = [
        "/templates/probel/js/bootstrap.min.js",
        "/templates/probel/js/plugins.js",
        "/templates/probel/js/main.js"
    ];

    window.addEventListener('DOMContentLoaded', (event) => {

    });
</script>
	
</body>
</html>