<?php
 
$title=$_SERVER['REQUEST_URI'];
$title=explode('/',$title);
$title=$title[1];
if(!empty($title))
{
$condi=array('title'=>$title);
$page_condi=array('page_url'=>$title);
$pages=get_data('cms_menu',$page_condi,"=");
foreach($pages as $menu){
$page_name=$menu['page_name'];
$page_title=$menu['page_title'];
$page_keyword=$menu['page_keyword'];
$page_url=$menu['page_url'];
$page_description=$menu['page_description'];
$meta_description=$menu['message'];
$up_image=$menu['up_image'];
$himage=$menu['himage'];
$middle=$menu['fvicon'];
}
}elseif($_GET['alias']){
$alias=$_GET['alias'];
$condi=array('ct_pd_url'=>$alias,'status'=>1);
$categories=get_data('cat_prod',$condi,"=");
foreach($categories as $cat){
$meta_description=$cat['ct_pd_mt_ds'];
$page_title=$cat['ct_pd_title'];
$page_url=$cat['ct_pd_url'];
}
}else{
//$condi=array('title'=>'home');
$page_condi=array('page_url'=>'home');
$pages=get_data('cms_menu',$page_condi,"=");
foreach($pages as $menu){
$page_name=$menu['page_name'];
$page_title=$menu['page_title'];
$page_keyword=$menu['page_keyword'];
$page_url=$menu['page_url'];
$page_description=$menu['page_description'];
$meta_description=$menu['message'];
$up_image=$menu['up_image'];
$himage=$menu['himage'];
$middle=$menu['fvicon'];
}
}
$footers=get_data('users');
foreach($footers as $footer){
$mobile=$footer['mobile'];
$email=$footer['email'];
$company_name=$footer['company_name'];
$address=$footer['address'];
 
$facebook_link=$footer['facebook_link'];
$twittter_link=$footer['twittter_link'];
 
$instagram_link=$footer['instagram_link'];
$gstin=$footer['gstin'];
$youtube_link=$footer['youtube_link'];
 
$whatsapp_number=$footer['whatsapp_number'];
$copyright=$footer['copyright'];
$google_map=$footer['google_map'];
}
if(!empty($_SESSION['authuserid']) && isset($_SESSION['authuserid']))
{
$authemailid= $_SESSION['authuserid'];
$data=array('email'=>$authemailid);
$authuser=get_data('tbl_user',$data,"=");
foreach($authuser as $auser)
{
$authid=$auser['id'];    
$auth_email=$auser['email'];    
$name=$auser['name'];       
$address=$auser['address'];    
$mobile=$auser['mobile'];    
$city=$auser['city'];   
$state=$auser['state'];    
$country=$auser['country'];    
$pincode=$auser['pincode'];    

}
}
$noimage=admin_base_url().'uploads/no-image.jpg';
?>


<!-- Start header -->
<section class="header">
  <nav id="headerdown">
    <div class="container">
      <div class="row-t">
        <div class="logo">
          <a href="<?=base_url()?>">
              <?php

$logos=get_data('logo');
foreach($logos as $logo){

}
if(!empty($logo['logo_image']))
{
?>
            <img src="<?php echo admin_base_url().'uploads/logo/'. $logo['logo_image'];?>" class="logo-header" alt="">
            <?php    
}else{

echo $logo['logo_title'];

}

?>
          </a>
        </div>
        <div class="mobile_btn">
          <i class="fas fa-bars"></i>
        </div>
        <div class="main_menu">
          <ul>

<?php 
$menus=get_data('cms_menu');
$i=1;
foreach($menus as $menu){
if($i==1){
$active="active";
}else{
$active="";
}
if($menu['page_type']=='category'){ 
?>
            <li><a href="index.php" class="active"><?php echo $menu["page_name"]; ?></a>
<ul class="cs-dropdown">
 <?php 
$condi=array('category_id'=>$menu['id']);
$produts_menu=get_data('cat_prod',$condi,"=");
foreach($produts_menu as $prodcut_menu){
?>

<li><a href="<?=base_url().'/'.$prodcut_menu['ct_pd_url']?>"><?php echo $prodcut_menu['ct_pd_name']; ?></a>                                        </li>
 <?php 

}
?> 


</ul>    
</li>

<?php }else{
if($menu["page_url"] == 'home'){

$menuurl="";
}else{

$menuurl=$menu["page_url"].'/';
}
echo '<li ><a href="'.base_url().$menuurl.'">'.$menu["page_name"].'</a></li>';
}
$i++;

}
?>
           
          </ul>
        </div>
      </div>
    </div>
  </nav>
</section>
<!-- End header -->


