<div class="columns-container">
    <div class="container" id="columns">
        <!-- breadcrumb -->
        <div class="breadcrumb clearfix">
            <a class="home" href="index.html" title="Anasayfaya Git">Anasayfa</a>
            <span class="navigation-pipe">&nbsp;</span>
            <span class="navigation_page">Blog</span>
        </div>
        <!-- ./breadcrumb -->
        <!-- row -->
        <div class="row">
            <!-- Left colunm -->
            <div class="column col-xs-12 col-sm-3" id="left_column">
                <!-- Popular Posts -->
                <div class="block left-module">
                    <p class="title_block">EN ÇOK OKUNANLAR</p>
                    <div class="block_content">
                        <!-- layered -->
                        <div class="layered">
                            <div class="layered-content">
                                <ul class="blog-list-sidebar clearfix">
								<?php $Sorgu = Sorgu("SELECT * FROM bloglar WHERE durum = '1' ORDER BY hit DESC LIMIT 3");
									while($Sonuc = Sonuc($Sorgu)){?>
									<?php $ys = Sorgu("SELECT * FROM yorumlar WHERE durum = '1' AND blog_id = '$Sonuc->id'");?>
                                    <li>
                                        <div class="post-thumb">
                                            <a href="Blog/<?php echo $Sonuc->seo;?>.html"><img src="uploads/bloglar/thumb/<?php echo $Sonuc->resim;?>" alt="<?php echo $Sonuc->adi;?>"></a>
                                        </div>
                                        <div class="post-info">
                                            <h5 class="entry_title" style="font-size:12px;"><a href="Blog/<?php echo $Sonuc->seo;?>.html"><?php echo $Sonuc->adi;?></a></h5>
                                            <div class="post-meta">
                                                <span class="date"><i class="fa fa-calendar"></i> <?php echo $Sonuc->tarih;?></span>
                                                <span class="comment-count">
                                                    <i class="fa fa-eye"></i> <?php echo $Sonuc->hit;?>
                                                </span>
												<span class="comment-count">
                                                    <i class="fa fa-comment-o"></i> <?php echo mysql_num_rows($ys);?>
                                                </span>
                                            </div>
                                        </div>
                                    </li>
								<?php }?>
                                </ul>
                            </div>
                        </div>
                        <!-- ./layered -->
                    </div>
                </div>
                <!-- ./Popular Posts -->
                <!-- left silide -->
				<div class="block left-module">
                <div class="col-left-slide left-module">
                    <ul class="owl-carousel owl-style2" data-loop="false" data-nav = "false" data-margin = "30" data-autoplayTimeout="1000" data-autoplayHoverPause = "true" data-items="1" data-autoplay="true">
                     <?php reklam();?>
                    </ul>
                </div>
                </div>
                <!-- Recent Comments -->
                <div class="block left-module">
                    <p class="title_block">SON YORUMLAR</p>
                    <div class="block_content">
                        <!-- layered -->
                        <div class="layered">
                            <div class="layered-content">
                                <ul class="recent-comment-list">
								<?php $Sorgu = Sorgu("SELECT * FROM yorumlar WHERE durum = '1' ORDER BY id DESC LIMIT 3");
								while($Sonuc = Sonuc($Sorgu)){?> 
                                    <li>
                                        <h5><a href="javascript:void(0);"> <?php echo $Sonuc->isim;?></a></h5>
                                        <div class="comment">
                                            <?php echo $Sonuc->mesaj;?>
                                        </div>
                                    </li>
								<?php }?>
                                </ul>
                            </div>
                        </div>
                        <!-- ./layered -->
                    </div>
                </div>
                <!-- ./Recent Comments -->
                <!-- TAGS -->
                <div class="block left-module">
                    <p class="title_block">ETİKETLER</p>
                    <div class="block_content">
                        <div class="tags">
						<?php $Sorgu = Sorgu("SELECT * FROM etiketler WHERE durum = '1' ORDER BY id DESC");
						while($Sonuc = Sonuc($Sorgu)){?>
                            <a href="<?php echo $Sonuc->url;?>"><span class="level<?php echo rand(1,5);?>"><?php echo $Sonuc->adi;?></span></a>
						<?php }?>
                        </div>
                    </div>
                </div>
                <!-- ./TAGS -->
            </div>
            <!-- ./left colunm -->
            <!-- Center colunm-->
            <div class="center_column col-xs-12 col-sm-9" id="center_column">
                <h2 class="page-heading">
                    <span class="page-heading-title2">BLOG</span>
                </h2>
                <ul class="blog-posts">
				<?php 
				$page = @intval($_GET['s']);
				if(!$page) $page = 1;
				$total = mysql_num_rows(mysql_query("SELECT * FROM bloglar WHERE durum = '1'"));
				$limit= 4;
				$page_count = ceil($total/$limit);
				if($page > $page_count) $page = 1;
				$show = $page * $limit - $limit;
				$Sorgu = Sorgu("SELECT * FROM bloglar WHERE durum = '1' ORDER BY id DESC LIMIT $show,$limit");
				while($Sonuc = Sonuc($Sorgu)){?>
                    <li class="post-item">
                        <article class="entry">
                            <div class="row">
                                <div class="col-sm-5">
                                    <div class="entry-thumb image-hover2">
                                        <a href="Blog/<?php echo $Sonuc->seo;?>.html">
                                            <img src="uploads/bloglar/thumb/<?php echo $Sonuc->resim;?>" alt="<?php echo $Sonuc->adi;?>">
                                        </a>
                                    </div>
                                </div>
                                <div class="col-sm-7">
                                    <div class="entry-ci">
                                        <h3 class="entry-title"><a href="Blog/<?php echo $Sonuc->seo;?>.html"><?php echo $Sonuc->adi;?></a></h3>
                                        <div class="entry-meta-data">
											<span class="comment-count">
                                                <i class="fa fa-eye"></i> <?php echo $Sonuc->hit;?>
                                            </span>
											<?php $yorumlar = Sorgu("SELECT * FROM yorumlar WHERE blog_id = '$Sonuc->id'");?>
                                            <span class="comment-count">
                                                <i class="fa fa-comment-o"></i> <?php echo mysql_num_rows($yorumlar);?>
                                            </span>
                                            <span class="date"><i class="fa fa-calendar"></i> <?php echo $Sonuc->tarih;?></span>
                                        </div>
                                        <div class="entry-excerpt yazikisalt">
                                            <?php echo $Sonuc->aciklama;?>
                                        </div>
                                        <div class="entry-more">
                                            <a href="Blog/<?php echo $Sonuc->seo;?>.html">DEVAMINI OKU</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </article>
                    </li>
				<?php } ?>
                </ul>
                <div class="sortPagiBar clearfix">
                    <div class="bottom-pagination">
                        <nav>
						  <ul class="pagination">
							<?php
							if($total <= 4){
							}else{
								$showing = 3;
								if($page > 1){?>
								<?php $previous = $page - 1;?>
								<li><a href="blog.html?s=<?php echo $previous;?>">Önceki</a></li>
								<?php }else{?>
								<li><a href="javascript:void(0);">Önceki</a></li>	
								<?php }
								for($i= $page - $showing; $i < $page + $showing + 1; $i++){
								if($i > 0 and $i <= $page_count){
								if($i == $page){?>
								<li class="active"><a href="#"><?php echo $i; ?></a></li>
								<?php }else{?>
								<li><a href="blog.html?s=<?php echo $i; ?>"><?php echo $i; ?></a></li>
								<?php }
								}
								}
								if($page != $page_count){?>
								<?php  $next = $page +1;?>
								<li>
								  <a href="blog.html?s=<?php echo $next;?>" aria-label="Sonraki">
									<span aria-hidden="true">Sonraki &raquo;</span>
								  </a>
								</li>
								<?php }else{?>
								<li><a href="javascript:void(0);">Sonraki</a></li>
							<?php }} ?> 
							</ul>
                        </nav>
                    </div>
                </div>
            </div>
            <!-- ./ Center colunm -->
        </div>
        <!-- ./row-->
    </div>
</div>