<?php 

include_once("include/main.inc.php");


$hover=='blog';

@extract($_GET);

@extract($_POST);

@extract($_REQUEST);

if (preg_match('webpulse\.co$/', $_SERVER['HTTP_HOST'], $match)) {

	$match1=$match[1];

	$vanity_url='http://'.$_SERVER['HTTP_HOST'];

}

$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

$mm=$ee[4];

$ss=explode('.',$mm);

$cc=$ss[0];

$cat=str_replace("-", " ", $cc);

$cats=ucfirst($cat);

$catss=ucwords($cat);

$blog_name = ucwords(str_replace('-', ' ', $blog_name));

$sql_latest=mysqli_query($GLOBALS['dbconn'],"select catImage,catName,blogDname,catDesc,catDesc1,banner1,blog_written,blogDate,catID from blog_tbl where catName='$blog_name'");

$res_latest=mysqli_fetch_array($sql_latest);

$blogdisplay=$res_latest['blogDname'];

$blog_ID=$res_latest['catID'];

$page_metatitle=$res_latest['pageTitle']!=''?$res_latest['pageTitle']:$res_latest['blogDname'];

$page_metakey=$res_latest['pageKeywords']!=''?$res_latest['pageKeywords']:$res_latest['blogDname'];

$page_metadesc=$res_latest['pageDescription']!=''?$res_latest['pageDescription']:$res_latest['blogDname'];

$blog_desc=str_ireplace('{companyName}',$admin_res['companyName'],$res_latest['catDesc1']);

$date = new DateTime($res_latest['blogDate']);

$day = $date->format('d');

$month = $date->format('M');

$year = $date->format('Y');

if(mysqli_num_rows($sql_latest)>0){

    

}else{

     header("Location: " . site_url);

    exit;

}

?>
<!DOCTYPE html>
<html lang="en">

<head>
 
  <?php include 'app_top.php'; ?>
</head>

<body>
  <?php include 'app_header.php'; ?>
  <div class="breadcum-sec breadcum-sec2">
    <div class="container-fluid px-md-5">
      <ul>
        <li><a href="<?=site_url;?>" title="Home">Home</a></li>
        <li><a href="<?=site_url;?>/blogs.htm" title="Blogs">Blogs</a></li>
        <li><?=$blogdisplay;?></li>
      </ul>
    </div>
  </div>
  <div class="section">
    <div class="container">
      <div class="row g-4">
        <div class="col-lg-8 col-12">
          <div class="blog-sec">
            <h1 class="main-tt"><?=$blogdisplay;?></h1>
            <div class="img-bx">
              <img src="<?=getImage($res_latest['catImage'], 700, 500, $res_latest['catName'], "/uploaded-files/blog/images/"); ?>" alt="<?= $res_latest['blogDname']; ?>" title="<?= $res_latest['blogDname']; ?>">
            </div>
            <div class="content-sec p-0">
              <p><?php echo html_entity_decode($blog_desc);?></p>
            </div>
          </div>
        </div>
        <div class="col-lg-4 col-12">
          <div class="mini-blogs">
            <div class="head-sec text-start mb-3">
              <div class="tt fs-5">Related <span> Article</span></div>
            </div>
            <?php $blog_query1 = mysqli_query($GLOBALS['dbconn'], "select catImage,catName,blogDname,catDesc,blog_written,blogDate from blog_tbl where catID!='$blog_ID'");
 ?>

                <?php while ($blog_res1 = mysqli_fetch_assoc($blog_query1)) {

if ($blog_res1['catImage'] != '') {

    $blog_img =  getImage($blog_res1['catImage'], 700, 470, $blog_res1['catName'], "/uploaded-files/blog/images/");
} else {

    $blog_img = NO_IMG_URL;
}
$blog_shortdesc=str_ireplace('{companyName}',$admin_res['companyName'],$blog_res1['catDesc']);
?>
            <div class="blog-bx blog-card">
              <a href="<?= site_url; ?>/blog/<?= getValidFileName($blog_res1['catName']); ?>.htm" class="img-bx" title="<?= $blog_res1['blogDname'];?>">
                <img src="<?=$blog_img;?>"  alt="<?= $blog_res1['blogDname'];?>" title="<?= $blog_res1['blogDname'];?>">
              </a>
              <div class="tx-bx">
                <div class="tt"><a href="<?= site_url; ?>/blog/<?= getValidFileName($blog_res1['catName']); ?>.htm" title="<?= $blog_res1['blogDname'];?>"><?= $blog_res1['blogDname'];?></a></div>
                <p><?=substr($blog_shortdesc,0,150);?></p>
              </div>
            </div>
            <?php }?>
           
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php include 'app_footer.php'; ?>
  <?php include 'app_bottom.php'; ?>
</body>

</html>