D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
guruglobalpreschool.com
/
Filename :
gallery.php
back
Copy
<?php $page = "About Us"; include 'style.php'; ?> <body id="gallery"> <?php include 'header.php'; ?> <div class="main-content"> <!-- Breadcrumb Section --> <div class="rs-breadcrumbs breadcrumbs-overlay"> <div class="breadcrumbs-img"> <img src="assets/images/breadcrumbs/gallery-banner.jpg" alt="Breadcrumbs Image"> </div> <div class="breadcrumbs-text white-color"> <h1 class="page-title">Photo Gallery</h1> <ul> <li><a class="active" href="./">Home</a></li> <li>Photo Gallery</li> </ul> </div> </div> <?php // Database connection include 'config.php'; // Fetch all categories $cat_query = "SELECT * FROM `gallery_category`"; $cat_result = mysqli_query($conn, $cat_query); // Get selected category from URL if available $cat_id = ''; $condition = ''; if (isset($_GET['category']) && $_GET['category'] != '') { $cat_id = $_GET['category']; $condition = " WHERE image_category = $cat_id "; } // Fetch images based on category filter $img_query = "SELECT * FROM `image_gallery`" . $condition; $res_query = mysqli_query($conn, $img_query); ?> <!-- Gallery Filter Section --> <div class="container pt-30 pb-20"> <div class="filter-buttons text-center"> <a href="?category=" class="btn btn-outline-primary m-2">All</a> <?php if ($cat_result->num_rows > 0) { while ($category = mysqli_fetch_assoc($cat_result)) { ?> <a href="?category=<?php echo $category['category_id']; ?>" class="btn btn-outline-primary m-2"> <?php echo $category['category_name']; ?> </a> <?php } } ?> </div> </div> <!-- Gallery Section --> <div class="rs-gallery pt-50 pb-50 sm-pt-30 sm-pb-30"> <div class="container"> <div class="row"> <?php if ($res_query->num_rows > 0) { while ($img = mysqli_fetch_assoc($res_query)) { ?> <div class="col-lg-3 col-sm-6 col-xs-12 mb-30 col-md-6"> <div class="gallery-item"> <div class="gallery-img"> <a class="image-popup" href="admin/images-gallery/<?php echo $img['image_img']; ?>"> <img src="admin/images-gallery/<?php echo $img['image_img']; ?>" alt=""> </a> </div> <div class="title"> <?php echo $img['image_name']; ?> </div> </div> </div> <?php } } else { echo "<p class='text-center'>No images found in this category.</p>"; } ?> </div> </div> </div> </div> <?php include 'footer.php'; ?> </body> </html>