<!DOCTYPE html>
<html lang="en">

<head>
    <?php include("include/meta.php");?>
    <?php include("include/css.php");?>
</head>

<body>

    <!-- header area -->
    <?php include("include/header.php");?>
    <!-- header area end -->


    <main class="main">

        <!-- breadcrumb -->
        <?php
            $banner_sql = "SELECT * FROM data_table WHERE up_by = $x && page_type = 'slider' && recycle = '1' ORDER BY id DESC";
            $banner_run = mysqli_query($con, $banner_sql);
            if ($banner_row = mysqli_fetch_assoc($banner_run)) {
            ?>
        <div class="site-breadcrumb" style="background: url(./login/upload/<?php echo $banner_row['image_one']?>)">
            <div class="container">
                <h2 class="breadcrumb-title">Our Facilities</h2>
                <ul class="breadcrumb-menu">
                    <li><a href="index.php">Home</a></li>
                    <li class="active">Our Facilities</li>
                </ul>
            </div>
        </div>
        <?php }?>
        <!-- breadcrumb end -->



        <!-- facility area -->
        <div class="facility-area py-120">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6 mx-auto">
                        <div class="site-heading text-center">
                            <span class="site-title-tagline"><i class="far fa-book-open-reader"></i> Our
                                Facilities</span>
                            <h2 class="site-title">Let's Check Our <span>Facilities</span></h2>
                            <p>We have modern amenities and safe, nurturing spaces where students thrive academically,
                                physically, and emotionally.Lets explore our school facilities which your children will
                                enjoy-</p>
                        </div>
                    </div>
                </div>
                <div class="row justify-content-center align-items-center">
                    <?php
                    $features_sql = "SELECT * FROM data_table WHERE up_by = $x AND page_type = 'facility' AND recycle = '1' ORDER BY id ASC";
                    $features_run = mysqli_query($con, $features_sql);
                    $c = 1;

                    while ($features_row = mysqli_fetch_assoc($features_run)) {
                        // Split long description into sentences using regex
                        $sentences = preg_split('/(?<=[.!?])\s+/', trim($features_row['long_des']));
                    ?>
                    <div class="col-md-6 col-lg-6">
                        <div class="facility-item wow fadeInUp" data-wow-delay=".25s">
                            <div class="facility-img">
                                <img src="./login/upload/<?php echo htmlspecialchars($features_row['image_one']); ?>"
                                    alt="">
                            </div>
                            <div class="facility-content">
                                <h3 class="facility-title mb-3">
                                    <?php echo htmlspecialchars($features_row['title']); ?>
                                    <span style="color:#eb9602;font-size: 26px;">
                                        <?php echo htmlspecialchars($features_row['short_des']); ?>
                                    </span>
                                </h3>
                                <div class="facility-text">
                                    <?php 
                                    foreach ($sentences as $index => $sentence) {
                                        if (!empty(trim($sentence))) {
                                            echo "<p>" . $sentence. "</p>";
                                        }
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php } ?>
                </div>

            </div>
        </div>
        <!-- facility area end -->

    </main>



    <!-- footer area -->
    <?php include("include/footer.php");?>
    <!-- footer area end -->

    <!-- js -->
    <?php include("include/js.php");?>

</body>

</html>