Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
// Include the database connection class
include 'includes/header.php';
include 'includes/databaseConn.php';
// Get database connection
$db = new Database();
$conn = $db->getConnection();
// Fetch first 3 published villas with their main photo
$sql = "SELECT v.villa_id, v.titel, v.plaats, v.omschrijving, v.prijs_per_nacht,
f.bestandspad as main_image
FROM villas v
LEFT JOIN fotos f ON v.villa_id = f.villa_id AND f.is_hoofdfoto = 1
WHERE v.is_gepubliceerd = 1
ORDER BY v.villa_id DESC
LIMIT 3";
$stmt = $conn->prepare($sql);
$stmt->execute();
$recommendedVillas = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vakantie Villa Verkenner - Jouw Droomvilla in Noorwegen</title>
<link rel="stylesheet" href="css/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
</head>
<body>
<main>
<section class="hero-section">
<h1>VIND JOU DROOMVILLA IN NOORWEGEN</h1>
<a href="VillaPage.php" class="btn">Ontdek onze villa's</a>
</section>
<section class="recommended-villas-section container">
<div class="intro">
<h2>Aanbevolen villa's</h2>
<p class="subtitle">Unieke locaties</p>
<a href="VillaPage.php" class="btn">Ontdek onze villa's</a>
</div>
<div class="villa-cards-grid">
<?php if (!empty($recommendedVillas)): ?>
<?php foreach ($recommendedVillas as $villa): ?>
<?php
// Prepare image path
$imagePath = 'images/villa.png'; // default
if (!empty($villa['main_image'])) {
$imagePath = $villa['main_image'];
if (strpos($imagePath, '') !== 0) {
$imagePath = '' . $imagePath;
}
}
// Truncate description to 80 characters
$description = $villa['omschrijving'];
if (strlen($description) > 80) {
$description = substr($description, 0, 80) . '...';
}
?>
<div class="villa-card">
<a href="VillaInfo.php?id=<?php echo $villa['villa_id']; ?>">
<img src="<?php echo htmlspecialchars($imagePath); ?>" alt="<?php echo htmlspecialchars($villa['titel']); ?>">
<div class="villa-card-content">
<h3><?php echo htmlspecialchars($villa['titel']); ?></h3>
<p><?php echo htmlspecialchars($description); ?></p>
</div>
</a>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="villa-card">
<img src="images/villa.png" alt="Geen villa's beschikbaar">
<div class="villa-card-content">
<h3>Geen villa's beschikbaar</h3>
<p>Er zijn momenteel geen villa's gepubliceerd.</p>
</div>
</div>
<?php endif; ?>
</div>
</section>
<section class="welcome-villaverkenner container">
<div class="text-content">
<h2>Welkom bij VillaVerkenner</h2>
<p>
Bij VillaVerkenner specialiseren we ons in de bemiddeling en verkoop van exclusieve villa's en vakantiehuizen in de meest adembenemende regio's van Noorwegen. Of u nu droomt van een moderne architectonische parel aan een fjord, een traditioneel Noors huis bij de bergen, of een afgelegen landgoed met uitzicht op het noorderlicht, wij helpen u de perfecte villa te vinden die aan al uw wensen voldoet. Ontdek onze unieke collectie en begin vandaag nog met het plannen van uw droomvakantie.
</p>
</div>
<div class="image-content">
<img src="images/interieur.png" alt="Interieur van een Noorse villa">
</div>
</section>
</main>
<?php include 'includes/footer.php'; ?>
</body>
</html>