<?php include("_ayarlar.php"); ?>
<?php include("_fonksiyonlar.php"); ?>
<?php include("_header.php"); ?>
<?php
    $ara = @$_GET["ara"];
?>

    <div class="section search-result-wrap">
		<div class="container">
			<div class="row">
				<div class="col-12">
					<div class="heading">Ara: <?php echo $ara; ?></div>
				</div>
			</div>
            <div class="row">
                <?php
                # $sql = "SELECT * FROM haber INNER JOIN kategori ON haber.kategori = kategori.kategori_id WHERE baslik LIKE '%$ara%' OR icerik LIKE '%$ara%' ";
                $sql = "SELECT * FROM haber INNER JOIN kategori ON haber.kategori = kategori.kategori_id WHERE MATCH (baslik, icerik) AGAINST ('*$ara*'IN BOOLEAN MODE)";
                $tablo = $vt->query($sql);
                while($satir=$tablo->fetch_array()){
                ?>
                <div class="col-lg-4 mb-4">
                    <div class="post-entry-alt">
                        <a href="haber.php?id=<?php echo $satir['id'] ?>&baslik=<?php echo baslik_donustur($satir['baslik']) ?>" class="img-link"><img src="kapak/<?php echo $satir['kapak'] ?>" alt="Image"
                            class="img-fluid rounded" style="background-size: cover; height: 300px; object-fit: cover;"></a>
                        <div class="excerpt">
                            <h2><a href="haber.php?id=<?php echo $satir['id'] ?>&baslik=<?php echo baslik_donustur($satir['baslik']) ?>"><?php echo $satir['baslik'] ?></a></h2>
                            <div class="post-meta align-items-center text-left clearfix">
                                <span class="d-inline-block mt-1"><?php echo "<a href='kategori.php?id=$satir[kategori]&baslik=".baslik_donustur($satir['kategori_ad'])."'>".$satir['kategori_ad']."</a>" ?></span>
                                <span>&nbsp;-&nbsp; <?php echo tarih_donustur($satir['eklenme_tarihi']) ?></span>
                            </div>
                            <?php echo implode(' ', array_slice(explode(' ', $satir['icerik']), 0, 20)) ?>...
                            <p><a href="haber.php?id=<?php echo $satir['id'] ?>&baslik=<?php echo baslik_donustur($satir['baslik']) ?>" class="read-more">Okumaya Devam Et</a></p>
                        </div>
                    </div>
                </div>
                <?php
                }
                ?>
            </div>
        </div>
    </div>

<?php include("_footer.php"); ?>