<link href="css/blog.css" rel="stylesheet">

<main class="bg_gray">
	<div class="container margin_30">
		<div class="page_header">
			<div class="breadcrumbs">
				<ul>
					<li><a href="<?=SITE?>">Anasayfa</a></li> 
					<li>Blog</li>
				</ul>
			</div> 
		</div>
		<!-- /page_header -->
		<div class="row">
			<div class="col-lg-9"> 
				<div class="row">
					<?php 
					if ($_GET && !empty($_GET["kelime"])) 
					{
						if (!empty($_GET["kelime"])) 
						{
							$kelime=$VT->filter($_GET["kelime"]);
							$bloglar=$VT->VeriGetir("bloglar","WHERE durum=? AND (baslik) LIKE ? OR metin LIKE ?",
								array(1,'%'.$kelime.'%','%'.$kelime.'%'),"ORDER BY sirano ASC");
						}
						else
						{
							$bloglar=$VT->VeriGetir("bloglar","WHERE durum=?",array(1),"ORDER BY sirano ASC");
						} 
					}
					else
					{
						$bloglar=$VT->VeriGetir("bloglar","WHERE durum=?",array(1),"ORDER BY sirano ASC");
					}
					if ($bloglar!=false)
					{
						for ($i=0; $i <count($bloglar) ; $i++) { 

							if(!empty($bloglar[$i]["resim"])) 
							{
								$resim=$bloglar[$i]["resim"];
							}
							else
							{
								$resim="varsayilan";
							}

							?>
							<div class="col-md-6">
								<article class="blog">
									<figure>
										<a href="<?=SITE?>blog-detay/<?=$bloglar[$i]["seflink"]?>"><img src="<?=SITE?>images/bloglar/<?=$resim?>" data-src="<?=SITE?>images/bloglar/<?=$resim?>" alt="">
											<div class="preview"><span>Devamını oku...</span></div>
										</a>
									</figure>
									<div class="post_info"> 
										<h2><a href="<?=SITE?>blog-detay/<?=$bloglar[$i]["seflink"]?>"><?=stripslashes($bloglar[$i]["baslik"])?></a></h2>
										<?=mb_substr(strip_tags(stripslashes($bloglar[$i]["metin"])),0,160,"UTF-8")?>...
										<ul>
											<li>
												<div class="thumb"><img src="img/avatar.jpg" alt=""></div> Yazar Admin
											</li>
											<li><i class="ti-calendar"></i><?=stripslashes($bloglar[$i]["tarih"])?></li>
										</ul>
									</div>
								</article>
								<!-- /article -->
							</div>
							<!-- /col -->  
							<?php
						}
					}
					?>
				</div>
				<!-- /row -->

				<div class="pagination__wrapper no_border add_bottom_30">
					<ul class="pagination">

						<li><a href="#0" class="prev" title="previous page">&#10094;</a></li>
						<li>
							<a href="#0" class="active">1</a>
						</li>
						<li>
							<a href="#0">2</a>
						</li>
						<li>
							<a href="#0">3</a>
						</li>
						<li>
							<a href="#0">4</a>
						</li>
						<li><a href="#0" class="next" title="next page">&#10095;</a></li>
					</ul>
				</div>
				<!-- /pagination -->

			</div>
			<!-- /col -->

			<aside class="col-lg-3"> 
				<form action="#" method="get"> 
					<div class="widget search_blog d-none d-sm-none d-md-none d-lg-block">
						<div class="form-group">
							<input type="text" name="kelime" class="form-control" placeholder="Arama..">
							<button type="submit"><i class="ti-search"></i><span class="sr-only">Arama Yap</span></button>
						</div>
					</div>
				</form>
				<!-- /widget -->
				<div class="widget">
					<div class="widget-title">
						<h4>Son Gönderi</h4>
					</div>
					<ul class="comments-list">
						<?php 
						if ($_GET && !empty($_GET["kelime"])) 
						{
							if (!empty($_GET["kelime"])) 
							{
								$kelime=$VT->filter($_GET["kelime"]);
								$bloglar=$VT->VeriGetir("bloglar","WHERE durum=? AND (baslik) LIKE ? OR metin LIKE ?",
									array(1,'%'.$kelime.'%','%'.$kelime.'%'),"ORDER BY sirano ASC");

							}
							else
							{
								$bloglar=$VT->VeriGetir("bloglar","WHERE durum=?",array(1),"ORDER BY sirano ASC");

							} 

						}
						else
						{
							$bloglar=$VT->VeriGetir("bloglar","WHERE durum=?",array(1),"ORDER BY sirano ASC");
						}


						if ($bloglar!=false)
						{
							for ($i=0; $i <count($bloglar) ; $i++) { 

								if(!empty($bloglar[$i]["resim"])) 
								{
									$resim=$bloglar[$i]["resim"];
								}
								else
								{
									$resim="varsayilan";
								}

								?>
								<li>
									<div class="alignleft">
										<a href="<?=SITE?>blog-detay/<?=$bloglar[$i]["seflink"]?>"><img src="<?=SITE?>images/bloglar/<?=$resim?>" alt=""></a>
									</div>
									<small><?=stripslashes($bloglar[$i]["tarih"])?></small>
									<h3><a href="<?=SITE?>blog-detay/<?=$bloglar[$i]["seflink"]?>" title="">	<?=mb_substr(strip_tags(stripslashes($bloglar[$i]["metin"])),0,50,"UTF-8")?>...</a></h3>
								</li>
								<?php
							}
						}
						?>
					</ul>
				</div>  
				<!-- /widget -->
			</aside>
			<!-- /aside -->
		</div>
		<!-- /row -->
	</div>
	<!-- /container -->
</main>
<!--/main-->
