<?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');

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

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <?php include 'app_top.php'; ?>
</head>

<body>
  <?php include 'app_header.php'; ?>
  <div class="img-breadcum img-breadcum2">
    <div class="container">
      <h1 class="tt"><?=$blogdisplay;?></h1>
    </div>
  </div>
  <div class="breadcum-sec">
    <div class="container-fluid px-md-5">
      <ul>
        <li><a href="<?=site_url;?>" title="Home">Home</a></li>
        <li><a href="<?=site_url;?>/blog.htm" title="Blog">Blog</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">
            <h2 class="main-tt"><?=$blogdisplay;?></h2>
            <div class="img-bx">
              <img src="<?=getImage($res_latest['catImage'], 695, 390, $res_latest['catName'], "/uploaded-files/blog/images/"); ?>" alt="<?= $res_latest['blogDname']; ?>" title="<?= $res_latest['blogDname']; ?>">
            </div>
            <div class="content-sec p-0">
             <?php echo html_entity_decode($blog_desc);?>
            </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'], 800, 450, $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" title="<?= $blog_res1['blogDname']; ?>" class="img-bx">
                <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>