test / blog.php
canerky3636's picture
Upload 28 files
bdb1674
<?php
include 'include/menu.php';
$metakey=$db->prepare("SELECT * from meta where meta_id=4");
$metakey->execute(array(0));
$metakeyprint=$metakey->fetch(PDO::FETCH_ASSOC);
?>
<title><?php echo $metakeyprint['meta_title'] ?></title>
<meta name="description" content="<?php echo $metakeyprint['meta_descr'] ?>">
<meta name="keywords" content="<?php echo $metakeyprint['meta_keyword'] ?>">
</head>
<?php
$sayfada = 6; // sayfada gösterilecek içerik miktarını belirtiyoruz.
$sorgu=$db->prepare("SELECT * from blog");
$sorgu->execute();
$toplam_icerik=$sorgu->rowCount();
$toplam_sayfa = ceil($toplam_icerik / $sayfada);
// eğer sayfa girilmemişse 1 varsayalım.
$sayfa = isset($_GET['sayfa']) ? (int) $_GET['sayfa'] : 1;
// eğer 1'den küçük bir sayfa sayısı girildiyse 1 yapalım.
if($sayfa < 1) $sayfa = 1;
// toplam sayfa sayımızdan fazla yazılırsa en son sayfayı varsayalım.
if($sayfa > $toplam_sayfa) $sayfa = $toplam_sayfa;
$limit = ($sayfa - 1) * $sayfada;
$blogsor1=$db->prepare("SELECT * from blog order by blog_tarih DESC limit $limit,$sayfada");
$blogsor1->execute();
?>
<!-- Page title -->
<section class="p-t-100 p-b-50 text-light" id="page-title" data-parallax-image="admin/assets/img/genel/data.jpg">
<div id="particles-js" class="particles text-light"></div>
<div class="container text-light">
<div class="breadcrumb text-light">
<ul>
<li><a href="<?php echo $settingsprint['ayar_siteurl']; ?>">AnaSayfa</a> </li>
<li class="active"><?php echo $widgetprint['widget_bblog']; ?></li>
</ul>
</div>
<div class="page-title">
<h1><?php echo $widgetprint['widget_bblog']; ?></h1>
</div>
</div>
</section>
<!-- end: Page title -->
<!-- Content -->
<section id="page-content">
<div class="container">
<!-- post content -->
<!-- Blog -->
<div id="blog" class="grid-layout post-3-columns m-b-30" data-item="post-item">
<?php
while($blogcek=$blogsor1->fetch(PDO::FETCH_ASSOC)) { ?>
<!-- Post item-->
<div class="post-item border">
<div class="post-item-wrap">
<div class="post-image">
<a href="<?=seo('blog-'.$blogcek["blog_baslik"]).'-'.$blogcek["blog_id"]?>">
<img alt="<?php echo $blogcek['blog_baslik']; ?>" src="admin/<?php echo $blogcek['blog_resim']; ?>">
</a>
</div>
<div class="post-item-description">
<span class="post-meta-date"><i class="fa fa-calendar-o"></i><?php echo substr($blogcek['blog_tarih'], 0,10); ?></span>
<h2><a href="<?=seo('blog-'.$blogcek["blog_baslik"]).'-'.$blogcek["blog_id"]?>"><?php
$karakter = strlen( $blogcek['blog_baslik'] );
if ( $karakter > 35 )
{
echo mb_substr( $blogcek['blog_baslik'], 0, 35, 'UTF-8' ) . '...';
}
else
{
echo $blogcek['blog_baslik'];
}
?>
</a></h2>
<p><?php echo substr($blogcek['blog_detay'], 0,100).'...'; ?></p>
<a href="<?=seo('blog-'.$blogcek["blog_baslik"]).'-'.$blogcek["blog_id"]?>" class="item-link">Devamını Oku <i class="fa fa-arrow-right"></i></a>
</div>
</div>
</div>
<!-- end: Post item-->
<?php } ?>
</div>
<!-- Pagination -->
<div class="pagination pagination-simple">
<ul>
<?php
$s=0;
while ($s < $toplam_sayfa) {
$s++; ?>
<?php
if ($s==$sayfa) {?>
<li class="active">
<a href="blog?sayfa=<?php echo $s; ?>"><?php echo $s; ?></a>
</li>
<?php } else {?>
<li>
<a href="blog?sayfa=<?php echo $s; ?>"><?php echo $s; ?></a>
</li>
<?php }
}
?>
</ul>
</div>
<!-- end: Pagination -->
</div>
<!-- end: post content -->
</section>
<!-- end: Content -->
<?php include 'include/footer.php'; ?>