<?php require('header.php');
$media = $o->findSql("SELECT * FROM media ORDER BY date DESC");
?>

    <div class="media-page__holder">
        <div class="section__head">
            <div class="wrapper head__wrapper">
                <h1 class="section__title">Media</h1>
                <div class="section__head__links">
                    <a href="index.php" class="section__head__link">Home</a>
                    <a href="about.php" class="section__head__link head__link__separator">About Us</a>
                    <span class="section__head__link__text head__link__separator">Media</span>
                </div>
            </div>
        </div>
        <div class="wrapper">
            <div class="media-page__content">
                <?php foreach ($media as $m) { ?>
                    <div class="media__item">
<!--                        --><?php //echo $m['name'] ?>
                        <a href="media-details.php?id=<?= $m['id']; ?>" class="media__image-holder">
                            <img src="<?= thumbnailLink($m['image'], 300, 300); ?>" alt="<?= $m['title']; ?>"
                                 title="<?= $m['title']; ?>"/>
                            <div class="page__item__entry">
                                <div class="page__entry__image"></div>
                            </div>
                        </a>
                        <div class="media__text-holder">
                            <a href="#" class="media__title__link">
                                <h2 class="media__item__title"><?= $m['title']; ?></h2>
                            </a>
                            <div class="media__text">
                                <?= truncateUtf8(strip_tags($m['text']), 200); ?>
                            </div>
                        </div>
                        <div class="media__button">
                            <a href="media-details.php?id=<?= $m['id']; ?>" class="media__link-holde">
                                <span class="media__link">Read more...</span>
                            </a>
                        </div>
                    </div>
                <?php } ?>

            </div>
        </div>
    </div>

<?php require('footer.php') ?>