<?php include('include/head.php'); ?>

<body>
    <!-- Spinner Start -->
    <div id="spinner" class="show bg-white position-fixed translate-middle w-100 vh-100 top-50 start-50 d-flex align-items-center justify-content-center">
        <div class="spinner-border text-primary" style="width: 3rem; height: 3rem;" role="status">
            <span class="sr-only">Loading...</span>
        </div>
    </div>
    <!-- Spinner End -->


    <?php include('include/header.php'); ?>


    <?php
                $banner = mysqli_query($conn, "SELECT * FROM `banners` where page_name='blog'");
                while($row = mysqli_fetch_array($banner))
                {
                    $photo = $row['banners'];
                }
                ?>
    <!-- Header Start -->
    <div class="container-fluid bg-primary page-header" style="background-image: url('<?php path(); ?>/admin/assets/images/banner-image/<?php echo $photo; ?>');">
        <div class="container ">
            <div class="row justify-content-center">
                <!-- <div class="col-lg-10 text-center">
                    <h1 class=" text-white animated slideInDown">Blog</h1>
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb justify-content-center">
                            <li class="breadcrumb-item"><a class="text-white" href="#">Home</a></li>
                            <li class="breadcrumb-item"><a class="text-white" href="#">Pages</a></li>
                            <li class="breadcrumb-item text-white active" aria-current="page">Blog</li>
                        </ol>
                    </nav>
                </div> -->
            </div>
        </div>
    </div>
    <!-- Header End -->


    <!-- ===== blog section start ==== -->
    <section class="user-blog">
        <div class="container">

            <!-- <div class="text-center">
                <h6 class="section-title bg-white text-center text-primary px-3">Our Blog</h6>
                <h1 class="mb-5">Our Blog</h1>
            </div> -->

            <div class="row">
                <?php
                $blog = mysqli_query($conn, "SELECT * FROM `blogs`");
                while($rok = mysqli_fetch_array($blog))
                {
                    $name = $rok['name'];
                    $banner = $rok['banner'];
                    $short_description = $rok['short_description'];
                    $created_at = $rok['created_at'];
                    $slug = $rok['slug'];
                ?>
                <div class="col-md-4">
                    <div class="item2">
                        <div class="blog-grid">
                            <div class="img-date">
                                <img src="<?php path() ?>/admin/assets/images/blog-image/<?php echo $banner; ?>" width="100%; height: 200px;">
                                <div class="date-blog"><?php echo $created_at; ?>
                                </div>
                            </div>
                            <div class="discretion-blog">
                                <a href="<?php path() ?>/blogs/<?php echo $slug; ?>">
                                    <h4><?php echo $name; ?></h4>
                                    <p><?php echo substr($short_description, 0, 140) . '.....'; ?></p>
                                </a>
                                <div class="btn-box">
                                <a class="btn btn-primary py-3 px-5 mt-2" href="<?php path() ?>/blogs/<?php echo $slug; ?>">Read more</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <?php
                }
                ?>
            </div>
        </div>
    </section>
    <!-- ==== blog section end ==== -->

    

    <?php include('include/footer.php'); ?>

</body>

</php>