<?php

$depth = __DIR__ . '/../../src/';

require_once $depth . 'inc/init.php';
require_once $depth . 'inc/cache_open.php';

?>
<?= $content_type ?>

<html lang="ru" prefix="og: http://ogp.me/ns#">
<head>
    <title><?= $page_title ?></title>
    <?php
    require_once $depth . 'inc/html_include.php';
    ?>
</head>
<body>

<?php
require_once $depth . 'inc/header.php';
?>
<!-- Main begin -->
<div class="main">
    <main id="main">
        <!-- Content center begin -->
        <?php
        $path = ['#' => 'Баннеры'];
        draw_path($path);

        draw_title('Баннеры');
        ?>
        <div class="main-content">
            <table width="444px" height="688" border="0" cellpadding="1" cellspacing="1" align="center">
                <?php
                // Select random logo
                $i = 0;
                mt_srand(time());
                $dh = opendir($_SERVER['DOCUMENT_ROOT'] . '/banners/');
                while (($filename = readdir($dh)) !== false) {
                    if (($filename != '.') && ($filename != '..') && ($filename != 'index.php')) {
                        // Place name of the picture into the array
                        $array[$i] = $filename;
                        $i++;
                    }
                }
                closedir($dh);

                foreach ($array as $iiValue) {
                    $bnr_src = '/banners/' . $iiValue;
                    echo '<tr align="center"><td width="33%"><img src="' . $bnr_src . '" alt=""></td></tr>';
                }
                ?>
            </table>
        </div>
        <!-- Content center end -->
    </main>
    <!-- Content left begin -->
    <?php
    require_once $depth . 'inc/l_catalog.php';
    ?>
    <!-- Content left end -->
    <!-- Content right begin -->
    <?php
    require_once $depth . 'inc/r_panel.php';
    ?>
    <!-- Content right end -->
</div>
<!-- Main end -->
<?php
require_once $depth . 'inc/footer.php';
require_once $depth . 'inc/cache_close.php';
?>
