<?php include_once 'header.php';?>

<?php 
 $blog_id=db_scalar("select blog_id from tbl_blogs where blog_url='$_REQUEST[blog_name]'");
 $blog_data=db_query("select * from tbl_blogs where blog_id='$blog_id'");
 $blog=mysqli_fetch_array($blog_data);
 $next = db_scalar("select blog_url from tbl_blogs where blog_id > '$blog[blog_id]' order by blog_id limit 1 ");
 $prev = db_scalar("select blog_url from tbl_blogs where blog_id < '$blog[blog_id]' order by blog_id desc limit 1 ");
?>

<!-- Start main-content -->
<section class="page-title" style="background-image: url('assets/images/background/page-title.jpg');">
<div class="auto-container">
<div class="title-outer">
<h1 class="title"><?=$blog['blog_title']?></h1>
<ul class="page-breadcrumb">
<li><a href="<?siteUrl()?>">Home</a></li>
<li><?=$blog['blog_title']?></li>
</ul>
</div>
</div>
</section>
<!-- end main-content -->

<!--Blog Details Start-->
<section class="blog-details pt-5 pb-5">
<div class="container">
<div class="row">
<div class="col-xl-9 col-lg-9">
<div class="blog-details__left">
<div class="blog-details__img">
<img alt="<?=altTitle($blog['image_alt'],$blog['blog_title'])?>" title="<?=altTitle($blog['image_title'],$blog['blog_title'])?>" src="<?=showImage($blog['blog_image_name'],'blog')?>">
<div class="blog-details__date">
<span class="day"><?=date('d',strtotime($blog['blog_add_date']))?></span>
<span class="month"><?=date('M',strtotime($blog['blog_add_date']))?></span>
</div>
</div>
<div class="blog-details__content">
<h3 class="blog-details__title"><?=$blog['blog_title']?></h3>
<p class="blog-details__text-2"><?=$blog['blog_description']?></p>
</div>
</div>
</div>
<div class="col-xl-3 col-lg-3">
<div class="sidebar">
<?php $blogs = db_query("select * from tbl_blogs where blog_status='Active' and blog_id!='$blog[blog_id]' order by blog_order_by ");
if(mysqli_num_rows($blogs) > 0){?>	
<div class="sidebar__single sidebar__post">
<h3 class="sidebar__title">Latest Posts</h3>
<ul class="sidebar__post-list list-unstyled">
<?php while($row = mysqli_fetch_array($blogs)){
 $name=wordLimit($row['blog_title'],15);
 $desc = wordLimit(strip_tags($row['blog_description']),80);
?>
<li>
<div class="sidebar__post-image"> <img alt="<?=altTitle($row['image_alt'],$row['blog_title'])?>" title="<?=altTitle($row['image_title'],$row['blog_title'])?>" src="<?=showImage($row['blog_image_name'],'blog')?>"> </div>
<div class="sidebar__post-content">
<h3> <a href="latest-updates/<?=$row['blog_url']?>" title='Puneet Immigration Services'><?=$name?></a> </h3>
</div>
</li>
<?php }?>
</ul>
</div>
<?php }?>
</div>
</div>
</div>
</div>
</section>
<!--Blog Details End-->

<?php include_once 'footer.php';?>