<?php include "includes/header.php"; ?>
<?php include "includes/head_ic.php"; ?>
<?php
$page_header_setting = $db->prepare("select * from page_header where page_id='service' order by id");
$page_header_setting->execute();
$pagehead = $page_header_setting->fetch(PDO::FETCH_ASSOC);
?>
<?php
$serviceayar = $db->prepare("select * from hizmet_ayar where id=:id");
$serviceayar->execute(array(
    'id' => '1'
));
$serv = $serviceayar->fetch(PDO::FETCH_ASSOC);
?>
<?php
$Sayfa = @intval($_GET['page']); if(!$Sayfa) $Sayfa = 1;
$Say = $db->query("select * from hizmet where durum='1' and dil='$_SESSION[dil]' order by sira ASC");
$ToplamVeri = $Say->rowCount();
$Limit = 12;
$Sayfa_Sayisi = ceil($ToplamVeri/$Limit); if($Sayfa > $Sayfa_Sayisi){$Sayfa = 1;}
$Goster = $Sayfa * $Limit - $Limit;
$GorunenSayfa = 5;
$Service_Liste = $db->query("select * from hizmet where durum='1' and dil='$_SESSION[dil]' order by sira ASC limit $Goster,$Limit");
$ServiceAl = $Service_Liste->fetchAll(PDO::FETCH_ASSOC);
?>
    <title><?php echo ucwords_tr($diller['hizmetlerimiz']) ?> | <?php echo $ayar['site_baslik']?></title>
    <meta name="description" content="<?php echo"$serv[meta_desc]" ?>">
    <meta name="keywords" content="<?php echo"$serv[tags]" ?>">
    <meta name="news_keywords" content="<?php echo"$serv[tags]" ?>">
    <meta name="author" content="<?php echo"$ayar[site_baslik]" ?>" />
    <meta itemprop="author" content="<?php echo"$ayar[site_baslik]" ?>" />
    <meta name="robots" content="index follow">
    <meta name="googlebot" content="index follow">
    <meta property="og:type" content="website" />

    <main class="main-content">
        <!--== Start Page Header Area Wrapper ==-->
        <div class="page-header-area" data-bg-img="tema/img/photos/bg1.webp">
            <div class="container pt--0 pb--0">
                <div class="row">
                    <div class="col-12">
                        <div class="page-header-content">
                            <h2 class="title"><?php echo ucwords_tr($diller['hizmetlerimiz']) ?></h2>
                            <nav class="breadcrumb-area">
                                <ul class="breadcrumb">
                                    <li><a href="index.html"><?php echo $diller['anasayfa'] ?></a></li>
                                    <li class="breadcrumb-sep">//</li>
                                    <li><?php echo ucwords_tr($diller['hizmetlerimiz']) ?></li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--== End Page Header Area Wrapper ==-->

        <!--== Start Blog Area Wrapper ==-->
        <section class="blog-area blog-inner-area">
            <div class="container">
                <div class="row">
                    <?php foreach ($ServiceAl as $ser)  {     ?>
                    <div class="col-md-6 col-lg-4">
                        <!--== Start Blog Item ==-->
                        <div class="post-item">
                            <div class="thumb">
                                <a href="hizmet/<?php echo seo($ser['id'])?>/<?php echo seo($ser['baslik']) ?>">
                                    <img style="width: 100%;height: 280px;object-fit: cover;" src="images/services/<?php echo $ser['gorsel'] ?>" alt="<?php echo $ser['baslik'] ?>">
                                </a>
                            </div>
                            <div class="content">
                                <h4 class="title"><a href="hizmet/<?php echo seo($ser['id'])?>/<?php echo seo($ser['baslik']) ?>"><?php echo $ser['baslik'] ?></a></h4>
                                <p><?php echo $ser['spot'] ?></p>
                                <a class="btn-theme btn-sm" href="hizmet/<?php echo seo($ser['id'])?>/<?php echo seo($ser['baslik']) ?>"><?php echo $diller['inceleyazi'] ?></a>
                            </div>
                        </div>
                        <!--== End Blog Item ==-->
                    </div>
                    <?php }?>

                    <?php if($Sayfa >= 1){?>
                    <nav aria-label="Page navigation example" style="margin-top: 50px;">
                        <ul class="pagination pagination-sm justify-content-center">
                            <?php } ?>

                            <?php if($Sayfa > 1){?>

                                <li class="page-item"><a class="page-link" href="hizmetlerimiz/1"><?=$diller['sayfalama-ilk']?></a></li>
                                <li class="page-item"><a class="page-link" href="hizmetlerimiz/<?=$Sayfa - 1?>"><?=$diller['sayfalama-onceki']?></a></li>

                            <?php } ?>
                            <?php
                            for($i = $Sayfa - $GorunenSayfa; $i < $Sayfa + $GorunenSayfa +1; $i++){ if($i > 0 and $i <= $Sayfa_Sayisi){
                                if($i == $Sayfa){
                                    echo '    
    
                            <li class="page-item active" aria-current="page">
                              <a class="page-link" href="hizmetler/'.$i.'">'.$i.'<span class="sr-only">(current)</span></a>
                            </li>
                            
                            ';
                                }else{
                                    echo '
                    <li class="page-item"><a class="page-link" href="hizmetlerimiz/'.$i.'">'.$i.'</a></li>
                    ';
                                }
                            }
                            }
                            ?>

                            <?php if($Service_Liste->rowCount() <=0) { } else { ?>
                                <?php if($Sayfa != $Sayfa_Sayisi){?>

                                    <li class="page-item"><a class="page-link" href="hizmetlerimiz/<?=$Sayfa + 1?>"><?=$diller['sayfalama-sonraki']?></a></li>
                                    <li class="page-item"><a class="page-link" href="hizmetlerimiz/<?=$Sayfa_Sayisi?>"><?=$diller['sayfalama-son']?></a></li>


                                <?php }} ?>

                            <?php if($Sayfa >= 1){?>
                        </ul>
                    </nav>
                <?php } ?>
                    <!---- Sayfalama Elementleri ================== !-->



                    <?php if ($Service_Liste->rowCount() <= 0) { ?>
                        <div class="service-image-box" data-appear-animation="fadeInUp" data-appear-animation-delay="100">



                            <img src="http://www.fpoimg.com/865x460" alt="NoImage">
                            <h1 class="font-open-sans"  ><?php echo $diller['boshizmet1'] ?></h1>



                            <h2 style="color:#<?php echo $serv['spot_color'] ?>"><?php echo $diller['boshizmet2'] ?></h2>
                        </div>
                    <?php } ?>
                </div>
            </div>
        </section>
        <!--== End Blog Area Wrapper ==-->
    </main>


<?php include "includes/footer.php"; ?>