<?php require('includes/cmain.inc.php'); ?>
<?php
$url = explode('/', rtrim($_SERVER["REQUEST_URI"],"/")); 
$count=count($url);
$urltag=str_replace('-',' ',trim($url[2]));
$urls= SITE_WS_PATH.'/'.$url[1];
$menuurl = ucwords(str_replace('-', ' ',$url[$count-1]));
$sqlmenu=mysqli_query($conn,"SELECT * FROM `tbl_blog`  where heading='".trim($menuurl)."' and status=1");
$menu=mysqli_fetch_array($sqlmenu);
$titlekb =$menu['title'];
$descriptionkb=$menu['description'];
$keywordkb=$menu['keyword'];?>
<?php include('header.php'); ?>

<div class="home-banner">
<ul class="home_slider cf mhide">    
<?php
$url = explode('/', rtrim($_SERVER["REQUEST_URI"],"/"));
$urls= SITE_WS_PATH.'/'.$url[1];
//'<pre>'; print_r($urls) ; '<pre>';
$blogurl = ucwords(str_replace('-', ' ',$url[1]));
if($urls=='https://www.metalstamping-dies.com/knowledge-base')
{
?> <img src="<?php echo SITE_WS_PATH; ?>/images/slider/Blog.webp" alt="Blog"/>"<?php    
}
?>
</ul>
</div>
<!-------------- start of knowledge base------------------>
<div class="welcome-sec">
<div class="container cf">

<div id="content"><br />
<div class="container">
<div class="col-md-9" >
	<ol class="breadcrumb breadcrumb-arrow">
  <li><a href="<?php echo SITE_WS_PATH; ?>">Home</a></li>
  <li><a href="<?php echo SITE_WS_PATH.'/knowledge-base';?>"> Knowledge Base</a></li>
  <li class="active"><span><?php echo ucwords($urltag); ?></span></li>
</ol>


<?php  $requri = $_SERVER['HTTP_HOST'].''.$_SERVER['REQUEST_URI']; 
       $segment =explode("/",$requri);   
	   $segment3=$segment[2];
	   $countryName= ucfirst(str_replace('-',' ',trim($segment3)));
       $sql = "select * from `tbl_blog` where heading = '$countryName'";
	    $result = mysqli_query($conn,$sql);
	  
	    if ($line_raw = mysqli_fetch_array($result)) {
		@extract($line_raw);
	    }
?>

  <div class="well gh">
      <div class="media" style="height:auto;">
      		<h1 class="media-heading innerh1"> <?php echo $countryName; ?></h1>
      		<ul class="list-inline list-unstyled">
  			<li><?php $fetchSQL = mysqli_fetch_array(mysqli_query($conn,"SELECT cat_name from tbl_blog where id='".$id."' and heading = '".$countryName."'"));
	 $items= explode(",", $fetchSQL['cat_name']); 
	foreach($items as $value){ 
	$dynamicURL=SITE_WS_PATH.'/knowledge-base/'.strtolower(str_replace(" ","-",$value));
    echo "<a href='$dynamicURL' class='btn btn-xs btn-primary'>".$value."</a>";   ?>  
	<?php } ?></li>
			 <p class="text-right vb"><span class="postb"> Posted by </span><?php echo $post_writer; ?></p>
            
			</ul>
		<?php $sv_image = $blog_banner;
		  //if(($sv_image != "") && (file_exists(UP_FILES_WS_PATH."/blog/original/".$sv_image))){
	    if($sv_image != ""){
		    $imgsrc=SITE_WS_PATH."/uploaded_files/blog/original/".$sv_image;		
		$size=getimagesize(UP_FILES_WS_PATH."/blog/original/".$sv_image); ?>	
		<a>
		<?php 
		echo '<img src="'.$imgsrc.'" alt="No Image" style="width:100%; height:400px" />';
		} else  ?>
		</a>
		<?php {  echo ''; } ?>
		
  		<div class="media-body kl">         
          <p><?php echo stripcslashes($content); ?></p>
          
       </div>
    </div>
  </div>
  
</div>

				
<div class="col-lg-3 right-form">
<div class="list-group" style="border-radius: 4px;">
 <ol class="breadcrumb" style="    background: #8e8d8d; color: #fff;  font-size: x-large;">Latest Blog</ol>
  <?php $sql123 = mysqli_query($conn,"select heading from tbl_blog where status=1 order by id ASC limit 10");
        while ($ddd = mysqli_fetch_array($sql123)) { ?>
        <a href="<?php echo SITE_WS_PATH.'/knowledge-base/'.$serviceUri=str_replace(" ", "-",strtolower($ddd['heading'])); ?>" class="list-group-item" style="line-height: 2em;"><i class="fa fa-link" aria-hidden="true"></i> <?php echo ucfirst(substr($ddd['heading'], 0, 30)).'...';?></a>  
   <?php } ?>
</div>
</div> 


</div>	
 </div>

</div>
</div>
</main>
</div>
</div>
<?php include('footer.php'); ?>