query("SELECT section_key, status FROM homepage_sections"); if ($result) { $sections = $result->fetchAll(); foreach ($sections as $section) { $homepageSections[$section['section_key']] = $section['status']; } } } else { $result = $mysqli->query("SELECT section_key, status FROM homepage_sections"); if ($result) { while ($row = $result->fetch_assoc()) { $homepageSections[$row['section_key']] = $row['status']; } } } } catch (Exception $e) { // Tablo yoksa varsayilan degerleri kullan $homepageSections = [ 'banner' => 1, 'about' => 1, 'services' => 1, 'cta' => 1, 'quality' => 1, 'counters' => 1, 'projects' => 1, 'blog' => 1 ]; } // Helper function: Bolumun aktif olup olmadigini kontrol et function isSectionEnabled($key, $sections) { return isset($sections[$key]) && $sections[$key] == 1; } // Bannerlari getir (sadece bolum aktifse) $banners = []; if (isSectionEnabled('banner', $homepageSections)) { if ($use_pdo) { $banners = $pdo->query("SELECT * FROM banners WHERE status = 1 ORDER BY `order` ASC, id ASC")->fetchAll(); } else { $result = $mysqli->query("SELECT * FROM banners WHERE status = 1 ORDER BY `order` ASC, id ASC"); $banners = $result ? dbFetchAll($result) : []; } } // Diger bolumleri getir $aboutSection = null; if (isSectionEnabled('about', $homepageSections)) { $currentLang = getCurrentLanguage(); // Metin iceriklerini secili dilden al if ($use_pdo) { $stmt = $pdo->prepare("SELECT * FROM about_section WHERE status = 1 AND lang_code = ? LIMIT 1"); $stmt->execute([$currentLang]); $aboutSection = $stmt->fetch(); } else { $stmt = $mysqli->prepare("SELECT * FROM about_section WHERE status = 1 AND lang_code = ? LIMIT 1"); $stmt->bind_param("s", $currentLang); $stmt->execute(); $result = $stmt->get_result(); $aboutSection = $result ? $result->fetch_assoc() : null; } // Gorselleri TR'den al (tum dillerde ayni gorseller kullanilir) if ($use_pdo) { $stmt = $pdo->prepare("SELECT image1, image2 FROM about_section WHERE status = 1 AND lang_code = 'tr' LIMIT 1"); $stmt->execute(); $trImages = $stmt->fetch(); } else { $stmt = $mysqli->prepare("SELECT image1, image2 FROM about_section WHERE status = 1 AND lang_code = 'tr' LIMIT 1"); $stmt->execute(); $result = $stmt->get_result(); $trImages = $result ? $result->fetch_assoc() : null; } // Gorselleri TR'deki gorsellerle birlestir if ($aboutSection && $trImages) { $aboutSection['image1'] = $trImages['image1'] ?? ''; $aboutSection['image2'] = $trImages['image2'] ?? ''; } } $services = []; if (isSectionEnabled('services', $homepageSections)) { $currentLang = getCurrentLanguage(); if ($use_pdo) { $stmt = $pdo->prepare("SELECT * FROM services WHERE status = 1 AND lang_code = ? ORDER BY `order` ASC, id ASC LIMIT 4"); $stmt->execute([$currentLang]); $services = $stmt->fetchAll(); } else { $stmt = $mysqli->prepare("SELECT * FROM services WHERE status = 1 AND lang_code = ? ORDER BY `order` ASC, id ASC LIMIT 4"); $stmt->bind_param("s", $currentLang); $stmt->execute(); $result = $stmt->get_result(); $services = $result ? dbFetchAll($result) : []; } } $ctaSection = null; if (isSectionEnabled('cta', $homepageSections)) { if ($use_pdo) { $ctaSection = $pdo->query("SELECT * FROM cta_section WHERE status = 1 LIMIT 1")->fetch(); } else { $result = $mysqli->query("SELECT * FROM cta_section WHERE status = 1 LIMIT 1"); $ctaSection = $result ? $result->fetch_assoc() : null; } } $qualitySection = null; $qualityItems = []; if (isSectionEnabled('quality', $homepageSections)) { $currentLang = getCurrentLanguage(); if ($use_pdo) { $qualitySection = $pdo->query("SELECT * FROM quality_section WHERE status = 1 LIMIT 1")->fetch(); // Kalite öğelerini dile göre getir $stmt = $pdo->prepare("SELECT * FROM quality_items WHERE status = 1 AND lang_code = ? ORDER BY `order` ASC, id ASC"); $stmt->execute([$currentLang]); $qualityItems = $stmt->fetchAll(); // Seçili dilde yoksa Türkçe'yi getir if (empty($qualityItems)) { $qualityItems = $pdo->query("SELECT * FROM quality_items WHERE status = 1 AND lang_code = 'tr' ORDER BY `order` ASC, id ASC")->fetchAll(); } } else { $result = $mysqli->query("SELECT * FROM quality_section WHERE status = 1 LIMIT 1"); $qualitySection = $result ? $result->fetch_assoc() : null; // Kalite öğelerini dile göre getir $stmt = $mysqli->prepare("SELECT * FROM quality_items WHERE status = 1 AND lang_code = ? ORDER BY `order` ASC, id ASC"); $stmt->bind_param("s", $currentLang); $stmt->execute(); $result = $stmt->get_result(); $qualityItems = $result ? dbFetchAll($result) : []; // Seçili dilde yoksa Türkçe'yi getir if (empty($qualityItems)) { $result = $mysqli->query("SELECT * FROM quality_items WHERE status = 1 AND lang_code = 'tr' ORDER BY `order` ASC, id ASC"); $qualityItems = $result ? dbFetchAll($result) : []; } } } $counters = []; if (isSectionEnabled('counters', $homepageSections)) { $currentLang = getCurrentLanguage(); if ($use_pdo) { $stmt = $pdo->prepare("SELECT * FROM counters WHERE status = 1 AND lang_code = ? ORDER BY `order` ASC, id ASC"); $stmt->execute([$currentLang]); $counters = $stmt->fetchAll(); // Seçili dilde sayaç yoksa Türkçe'yi getir if (empty($counters)) { $stmt = $pdo->prepare("SELECT * FROM counters WHERE status = 1 AND lang_code = 'tr' ORDER BY `order` ASC, id ASC"); $stmt->execute(); $counters = $stmt->fetchAll(); } } else { $stmt = $mysqli->prepare("SELECT * FROM counters WHERE status = 1 AND lang_code = ? ORDER BY `order` ASC, id ASC"); $stmt->bind_param("s", $currentLang); $stmt->execute(); $result = $stmt->get_result(); $counters = $result ? dbFetchAll($result) : []; // Seçili dilde sayaç yoksa Türkçe'yi getir if (empty($counters)) { $result = $mysqli->query("SELECT * FROM counters WHERE status = 1 AND lang_code = 'tr' ORDER BY `order` ASC, id ASC"); $counters = $result ? dbFetchAll($result) : []; } } } $projects = []; if (isSectionEnabled('projects', $homepageSections)) { if ($use_pdo) { $projects = $pdo->query("SELECT * FROM projects WHERE status = 1 ORDER BY `order` ASC, id ASC LIMIT 6")->fetchAll(); } else { $result = $mysqli->query("SELECT * FROM projects WHERE status = 1 ORDER BY `order` ASC, id ASC LIMIT 6"); $projects = $result ? dbFetchAll($result) : []; } } $blogPosts = []; if (isSectionEnabled('blog', $homepageSections)) { $currentLang = getCurrentLanguage(); if ($use_pdo) { // Önce seçili dildeki haberleri getir $stmt = $pdo->prepare("SELECT * FROM blog_posts WHERE status = 1 AND lang_code = ? ORDER BY published_at DESC, created_at DESC LIMIT 3"); $stmt->execute([$currentLang]); $blogPosts = $stmt->fetchAll(); // Seçili dilde haber yoksa Türkçe'yi getir if (empty($blogPosts)) { $blogPosts = $pdo->query("SELECT * FROM blog_posts WHERE status = 1 AND lang_code = 'tr' ORDER BY published_at DESC, created_at DESC LIMIT 3")->fetchAll(); } } else { // Önce seçili dildeki haberleri getir $stmt = $mysqli->prepare("SELECT * FROM blog_posts WHERE status = 1 AND lang_code = ? ORDER BY published_at DESC, created_at DESC LIMIT 3"); $stmt->bind_param("s", $currentLang); $stmt->execute(); $result = $stmt->get_result(); $blogPosts = $result ? dbFetchAll($result) : []; // Seçili dilde haber yoksa Türkçe'yi getir if (empty($blogPosts)) { $result = $mysqli->query("SELECT * FROM blog_posts WHERE status = 1 AND lang_code = 'tr' ORDER BY published_at DESC, created_at DESC LIMIT 3"); $blogPosts = $result ? dbFetchAll($result) : []; } } } // Yeni Urunler - Son eklenen 6 urun $newProducts = []; try { if ($use_pdo) { $newProducts = $pdo->query("SELECT * FROM products WHERE status = 1 ORDER BY id DESC LIMIT 6")->fetchAll(); } else { $result = $mysqli->query("SELECT * FROM products WHERE status = 1 ORDER BY id DESC LIMIT 6"); $newProducts = $result ? dbFetchAll($result) : []; } } catch (Exception $e) { $newProducts = []; } include 'includes/header.php'; ?>
about about
small

00+

shape shape

$service): ?>
<?php echo htmlspecialchars($service['title']); ?>
<?php echo htmlspecialchars($service['title']); ?>
May Fren May Fren

$product): ?>
<?php echo htmlspecialchars($product['name']); ?> <?php echo htmlspecialchars($product['name']); ?>

...

$item): ?>

counter counter

00+

MAY FREN MAY FREN

$post): $postDate = !empty($post['published_at']) ? $post['published_at'] : $post['created_at']; $formattedDate = date('d.m.Y', strtotime($postDate)); ?>
<?php echo htmlspecialchars($post['title']); ?> <?php echo htmlspecialchars($post['title']); ?>

...