📁 File Manager
Editing:
/home/wedigitalindia/public_html/demo.wedigitalindia.com/ndwemake/homedecor.php
<?php include("include/header.php"); include("admin/connection.php"); ?> <?php // Slug get + basic security $slug = isset($_GET['slug']) ? mysqli_real_escape_string($con, $_GET['slug']) : ''; if ($slug == '') { echo "<h3 class='text-center py-5'>No category selected.</h3>"; exit; } /* =============================== FETCH TOP CATEGORY =================================*/ $topQuery = mysqli_query($con, "SELECT * FROM tbl_top_category WHERE slug='$slug' LIMIT 1"); $topRow = mysqli_fetch_assoc($topQuery); if (!$topRow) { echo "<h3 class='text-center py-5'>Invalid category selected.</h3>"; exit; } $t_id = $topRow['t_id']; $topRow['cat_name']; ?> <?php // Get slug from URL $slug = isset($_GET['slug']) ? mysqli_real_escape_string($con, $_GET['slug']) : ""; // Default values (jab koi slug na ho) $Image = "assets/img/slider/about.webp"; // default banner image $page_name = "Car Brand"; // default title if (!empty($slug)) { // Fetch banner from DB $banner = mysqli_query($con, "SELECT * FROM banner WHERE page_name = '$slug' LIMIT 1"); if ($ban = mysqli_fetch_assoc($banner)) { // DB se sirf filename aata hai to usko path ke saath jodo if (!empty($ban['Image'])) { $Image = "admin/assets/images/banner/" . $ban['Image']; } $page_name = ucfirst(str_replace("-", " ", $ban['page_name'])); } } ?> <style> .popular-list-1 { padding: 0; -webkit-transition: .4s; transition: .4s; border-radius: 16px; overflow: hidden; box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; max-height: 375px !important; height: 345px; } @media (max-width: 767px) { .popular-list-1 { height: auto; } } </style> <div class="breadcumb-wrapper" data-bg-src="<?php echo path()?><?php echo $Image; ?>"> <div class="container"> </div> </div> <section class="th-blog-wrapper space-top overflow-hidden space-extra-bottom"> <div class="container-fluid"> <div class="row gx-60"> <!-- ================= SIDEBAR ================= --> <div class="col-xxl-4 col-lg-4"> <aside class="sidebar-area"> <div class="widget"> <h3 class="widget_title mb-3">All Category</h3> <div class="recent-post-wrap featured-listing"> <?php $topCats = mysqli_query($con, "SELECT * FROM tbl_top_category ORDER BY cat_name DESC"); while ($tc = mysqli_fetch_assoc($topCats)) { $activeClass = ($tc['slug'] == $slug) ? 'style="font-weight:bold;color:#d9534f;"' : ''; $catImage = !empty($tc['Image']) ? "admin/assets/images/service/" . $tc['Image'] : "admin/assets/images/service/default.jpg"; ?> <div class="recent-post"> <div class="media-img"> <a href="<?php echo path(); ?>homedecor/<?php echo $tc['slug']; ?>"> <img src="<?php echo path()?><?php echo $catImage; ?>" alt="<?php echo htmlspecialchars($tc['cat_name']); ?>"> </a> </div> <div class="media-body"> <h4 class="post-title"> <a <?php echo $activeClass; ?> href="<?php echo path(); ?>homedecor/<?php echo $tc['slug']; ?>"> <?php echo htmlspecialchars($tc['cat_name']); ?> </a> </h4> </div> </div> <?php } ?> </div> </div> </aside> </div> <!-- ================= PRODUCTS SECTION ================= --> <div class="col-xxl-8 col-lg-8"> <?php // Fetch Mid Categories under this Top Category $midQuery = mysqli_query($con, "SELECT * FROM mid_category WHERE t_id='$t_id' ORDER BY m_id ASC"); if (mysqli_num_rows($midQuery) > 0) { while ($mid = mysqli_fetch_assoc($midQuery)) { $m_id = $mid['m_id']; ?> <!-- Mid Category Title --> <div class="title-area text-center mb-4 mt-4"> <h2 class="sec-title"><?php echo htmlspecialchars($mid['title']); ?></h2> </div> <div class="row gy-30"> <?php // Fetch Products under this Mid Category $prodQuery = mysqli_query($con, "SELECT * FROM product WHERE m_id='$m_id' ORDER BY p_id ASC"); if (mysqli_num_rows($prodQuery) > 0) { while ($pc = mysqli_fetch_assoc($prodQuery)) { $productImage = !empty($pc['Image']) ? "admin/assets/images/service/" . $pc['Image'] : "admin/assets/images/service/default.jpg"; ?> <div class="col-xl-4 col-lg-4 col-md-6"> <div class="popular-list-1"> <div class="thumb-wrapper"> <a href="<?php echo $productImage; ?>"> <img src="<?php echo path()?><?php echo $productImage; ?>" alt="<?php echo htmlspecialchars($pc['title']); ?>"> </a> </div> <div class="property-content"> <h6 class="box-title"> <?php echo htmlspecialchars($pc['title']); ?> </h6> <div class="box-text"> <?php echo $pc['description']; ?> </div> </div> </div> </div> <?php } } else { echo "<div class='col-12 text-center'><p>No products found.</p></div>"; } ?> </div> <?php } } else { echo "<div class='text-center py-5'><h4>No sub categories found.</h4></div>"; } ?> </div> </div> </div> </section> <?php include("include/footer.php"); ?>
Save
Cancel