84 lines
2.9 KiB
PHP
84 lines
2.9 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
|
|
$page_title = 'Our Tours';
|
|
require_once 'partials/header.php';
|
|
|
|
$category_filter = $_GET['category'] ?? 'all';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$sql = "SELECT * FROM tour_packages";
|
|
if ($category_filter !== 'all') {
|
|
$sql .= " WHERE category = :category";
|
|
}
|
|
$stmt = $pdo->prepare($sql);
|
|
if ($category_filter !== 'all') {
|
|
$stmt->bindParam(':category', $category_filter);
|
|
}
|
|
$stmt->execute();
|
|
$tours = $stmt->fetchAll();
|
|
} catch (PDOException $e) {
|
|
echo 'Failed to fetch tours: ' . $e->getMessage();
|
|
$tours = [];
|
|
}
|
|
?>
|
|
|
|
<main id="main">
|
|
|
|
<!-- ======= Breadcrumbs ======= -->
|
|
<section class="breadcrumbs">
|
|
<div class="container">
|
|
<ol>
|
|
<li><a href="index.php">Home</a></li>
|
|
<li>Tours</li>
|
|
</ol>
|
|
<h2>Our Tours</h2>
|
|
</div>
|
|
</section><!-- End Breadcrumbs -->
|
|
|
|
<!-- ======= Tours Section ======= -->
|
|
<section id="tours" class="tours">
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12 d-flex justify-content-center">
|
|
<ul id="tours-flters">
|
|
<li class="<?php echo $category_filter === 'all' ? 'filter-active' : ''; ?>"><a href="tours.php?category=all">All</a></li>
|
|
<li class="<?php echo $category_filter === 'domestic' ? 'filter-active' : ''; ?>"><a href="tours.php?category=domestic">Domestic</a></li>
|
|
<li class="<?php echo $category_filter === 'international' ? 'filter-active' : ''; ?>"><a href="tours.php?category=international">International</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row gy-4 tours-container">
|
|
|
|
<?php if (empty($tours)): ?>
|
|
<div class="col-lg-12 text-center">
|
|
<p>No tours found for this category.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($tours as $tour): ?>
|
|
<div class="col-lg-4 col-md-6 tour-item">
|
|
<div class="tour-wrap">
|
|
<img src="<?php echo htmlspecialchars($tour['image_url']); ?>" class="img-fluid" alt="">
|
|
<div class="tour-info">
|
|
<h4><a href="tour-details.php?id=<?php echo $tour['id']; ?>"><?php echo htmlspecialchars($tour['name']); ?></a></h4>
|
|
<p><?php echo htmlspecialchars($tour['location']); ?></p>
|
|
<div class="tour-links">
|
|
<a href="tour-details.php?id=<?php echo $tour['id']; ?>" title="More Details"><i class="bi bi-link"></i></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</section><!-- End Tours Section -->
|
|
|
|
</main><!-- End #main -->
|
|
|
|
<?php require_once 'partials/footer.php'; ?>
|