<?php 
include_once("include/main.inc.php"); 
@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]";
$ee=explode('/',$actual_link);
$mm=$ee[3];
$ss=explode('.',$mm);
$cc=$ss[0];
$cat=str_replace("-", " ", $cc);
$cats=ucfirst($cat);
$cat_s="select * from category_tbl where catName='$cats'";
$cat_q=mysqli_query($GLOBALS['dbconn'],$cat_s);
$num=mysqli_num_rows($cat_q);
$cat_r=mysqli_fetch_array($cat_q);
$category_id=$cat_r['catID'];
$hover=$category_id;
$catn=$cat_r['catName'];

$cat_sql="select * from category_tbl where parentID='$category_id' and status='Y'";


$cat_qry=mysqli_query($GLOBALS['dbconn'],$cat_sql);

$cccnum=mysqli_num_rows($cat_qry);

$cat_sql1="select * from category_tbl where catID='$category_id'";

$cat_qry1=mysqli_query($GLOBALS['dbconn'],$cat_sql1);

$cat_res=mysqli_fetch_array($cat_qry1);

$page_metatitle=$cat_res['pageTitle'];

$page_metakey=$cat_res['pageKeywords'];

$page_metadesc=$cat_res['pageDescription'];

$pageTitles=$cat_res['catName'];

$disTitles=$cat_res['displayName']; 
$pdes=$cat_res['catDesc'];

$pdes1=$cat_res['catDesc1'];

$parent=$cat_res['parentID'];

$cat_sql2="select * from category_tbl where catID='$parent'";

$cat_qry2=mysqli_query($GLOBALS['dbconn'],$cat_sql2);

$num2=mysqli_num_rows($cat_qry2);

$cat_res2=mysqli_fetch_array($cat_qry2);

$mparent=$cat_res2['parentID'];

$cat_sql3="select * from category_tbl where catID='$mparent'";

$cat_qry3=mysqli_query($GLOBALS['dbconn'],$cat_sql3);

$num3=mysqli_num_rows($cat_qry3);

$cat_res3=mysqli_fetch_array($cat_qry3);

$mmparent=$cat_res3['parentID'];

$cat_sql4="select * from category_tbl where catID='$mmparent'";

$cat_qry4=mysqli_query($GLOBALS['dbconn'],$cat_sql4);

$num4=mysqli_num_rows($cat_qry4);

$cat_res4=mysqli_fetch_array($cat_qry4);


$admin_sql=mysqli_query($GLOBALS['dbconn'],"select * from admin_details");
$admin_res=mysqli_fetch_array($admin_sql);
$mobile=$admin_res['mobile'];
$city=$admin_res['city'];
$state=$admin_res['state'];
$country=$admin_res['country'];
$companyName=$admin_res['companyName'];
$address=$admin_res['address'];

if ($cat_res['headingtwo']!=''){
    $heading2 = $cat_res['headingtwo']." Manufacturers in Punjab";

}else{

    $heading= explode(',',$page_metatitle);
    $heading2= $heading[0];
    
}
$alt= explode(',',$page_metatitle);
$alt2= $alt[0];
if($num>0)
{
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php 
    if($page_metatitle!=''){

    ?>
    <title><?php echo $page_metatitle;?></title>
    <meta name="description" content="<?=$page_metadesc;?>" >
    <meta name="keywords" content="<?= $page_metakey;?>" >
    
    <?php }else{?>
        <title><?=COMPANY_NAME;?></title>
        <meta name="description" content="<?=COMPANY_NAME;?>" >
    <meta name="keywords" content="<?=COMPANY_NAME;?>" >
    
    <?php } ?>
    <?php include "app_top.php";?>
</head>

<body>
    <?php include "app_header.php";?>


    <!-- Heading Banner-->
    <?php if($cat_res['catBanner']!=''){ ?>
    
    <section class="heading_banner" style="background-image: url(<?=site_url;?>/uploaded-files/category/banners/<?php echo $cat_res['catBanner'];?>)" alt="#">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-center">
                    <h1 class="cat_title"><?= $cat_res['displayName'];?></h1>
                    <div class="clearfix"></div>
                    
                </div>
            </div>
        </div>
    </section>
<?php } else { ?>
    <section class="heading_banner" style="background-image: url(<?=site_url;?>/designer/images/category-banner.jpg)">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-center">
                <h1 class="cat_title"><?= $cat_res['displayName'];?></h1>
                    <div class="clearfix"></div>
                  
                </div>
            </div>
        </div>
    </section>
    <?php } ?>
    <!-- Breadcrumb-->
    <div class="inner_breadcrumb hidden_xs">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <ul class="breadcrumb">
                    <li><a href="<?=site_url;?>" title="Home">Home</a></li>
                        <?php if($num4 > 0) {?>
                            <li><a href="<?=site_url;?>/<?=getValidFileName($cat_res4['catName']);?>.htm" title="<?php echo $cat_res4['catName']; ?> "><?php echo $cat_res4['displayName']; ?></a>
                            </li>
                            <?php } ?>
                            <?php if($num3 > 0) {?>
                            <li><a href="<?=site_url;?>/<?=getValidFileName($cat_res3['catName']);?>.htm" title="<?php echo $cat_res3['catName']; ?>"><?php echo $cat_res3['displayName']; ?></a></li>
                            <?php } ?>
                            <?php if($num2 > 0) {?>
                            <li><a href="<?=site_url;?>/<?=getValidFileName($cat_res2['catName']);?>.htm" title="<?php echo $cat_res2['catName']; ?>"><?php echo $cat_res2['displayName']; ?></a></li>
                            <?php } ?>
                            <li class="active"><?php echo $cat_res['displayName'];?></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>


    <!-- Home About-->
    <section class="category_page">
        <div class="container">
            <div class="row">
                <?php include "app_sidebar.php"; ?>
                <div class="col-xxl-9 col-xl-9 col-lg-9 col-md-9 col-sm-9 col-12">
                    <div class="right_side">
                        <h2><?php echo $cat_res['catName']; ?> in Punjab</h2>
                        <div class="wps_right">
                            <div class="product_right_image">
                                <a href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#productID" onclick="$('#catID').val('<?php echo $related_res['catID']; ?>');
                                 $('#catName').val('<?php echo $cat_res['catName']; ?>');
                                 $('.catName').html('<?php echo $cat_res['catName']; ?>');  $('.catImg').attr('src','<?= getImage($cat_res['catImage'], 398, 398, $cat_res['catName'], "/uploaded-files/category/images/"); ?>');">
                                    <div class="detail_image">
                                        <img class="img-responsive" src="<?= getImage($cat_res['catImage'], 398, 398, $cat_res['catName'], "/uploaded-files/category/images/"); ?>" alt="<?php echo $alt2; ?>" title="<?php echo $alt2; ?>">
                                    </div>
                                    <span class="detail_enq_btn">Enquire Now</span>
                                </a>
                            </div>
                            <?php echo html_entity_decode($cat_res['catDesc1']);?>
                            <?php  
                                $product_s="select * from product_tbl where prodcut_subcat='$cat_res[catID]'";
                                $product_q=mysqli_query($GLOBALS['dbconn'],$product_s);
                                $num=mysqli_num_rows($product_q);
                                if($num > 0)
                                {  
                                    ?>

                            <div class="you_may"><?php echo $cat_res['displayName'];?> Range</div>
<?php while($product_res=mysqli_fetch_assoc($product_q)){
    $img_pro= getImage($product_res['product_image'], 400, 400, $product_res['	product_title'], "/uploaded-files/product-images/");
    ?>


                            <div class="product_listing">
                                <div class="row">
                                    <div class="col-xxl-4 col-xl-4 col-lg-4 col-md-4 col-sm-4 col-12">
                                        <div class="product">
                                           
                                                <div class="image1">
                                                    <img src="<?= getImage($product_res['product_image'], 267, 267, $product_res['	product_title'], "/uploaded-files/product-images/"); ?>" alt="<?=$product_res['product_title'];?> in Punjab" title="<?=$product_res['product_title'];?> in Punjab">
                                                </div>
                                            
                                            
                                            <p>Interested in this product?</p>
                                            <a class="read_more_product" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#productID" onclick="$('#catID').val('<?php echo $related_res['catID']; ?>');
                                 $('#catName').val('<?=$product_res['product_title'];?>');
                                 $('.catName').html('<?=$product_res['product_title'];?>');  $('.catImg').attr('src','<?=$img_pro;?>');" title="Get Best Quote"><i class="fa fa-envelope"></i> Get Best Quote</a>
                                        </div>
                                    </div>
                                    <div class="col-xxl-8 col-xl-8 col-lg-8 col-md-8 col-sm-8 col-12">
                                        <div class="right-content">
                                            <h3><?=$product_res['product_title'];?></h3>
                                            <div class="blue-line1"></div>

                                            <?=html_entity_decode($product_res['product_specfi']);?>
                                            
                                                
                                            <div class="clearfix"></div>
                                            <!-- <a href="details.php" class="read_more_product" title="">Read More <i class="fa fa-long-arrow-right fa-1x"></i></a> -->
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <?php } } ?>    
                           
                        <div class="you_may">You may Also Like</div>
                        <?php 
                        
                        $related_s = "select * from category_tbl where   parentID='$parent' and catID!='$category_id' and status='Y' order by catOrder";
                        $related_q = mysqli_query($GLOBALS['dbconn'],$related_s);
                        while($related_res=mysqli_fetch_array($related_q)) {
                            
                            if($related_res['catImage'] != ''){
                                
                                $img_link = getImage($related_res[catImage], 267, 267, $related_res[catName],"/uploaded-files/category/images/");
                                $img_link1 = getImage($related_res[catImage], 400, 400, $related_res[catName],"/uploaded-files/category/images/");
                            }else{
                                $img_link = NO_IMG_URL;
                                $img_link1 = NO_IMG_URL;
                                
                            }
            
                            ?>
                            <div class="product_listing">
                                <div class="row">
                                    <div class="col-xxl-4 col-xl-4 col-lg-4 col-md-4 col-sm-4 col-12">
                                        <div class="product">
                                            <a href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm" title="<?=$related_res['displayName'];?> in Punjab">
                                                <div class="image1">
                                                    <img src="<?= $img_link;?>" alt="<?php echo $alt2; ?>" title="<?php echo $alt2; ?>">
                                                </div>
                                            </a>

                                            <p>Interested in this product?</p>
                                            <a class="read_more_product" href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#productID" onclick="$('#catID').val('<?php echo $related_res['catID']; ?>');
                                 $('#catName').val('<?php echo $related_res['catName']; ?>');
                                 $('.catName').html('<?php echo $related_res['catName']; ?>');  $('.catImg').attr('src','<?=$img_link1;?>');" title="Get Best Quote"><i class="fa fa-envelope"></i> Get Best Quote</a>
                                        </div>
                                    </div>
                                    <div class="col-xxl-8 col-xl-8 col-lg-8 col-md-8 col-sm-8 col-12">
                                        <div class="right-content">
                                            <h4><a href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm" title="<?=$related_res['displayName'];?> in Punjab"><?=$related_res['displayName'];?></a></h4>
                                            <div class="blue-line1"></div>
                                            <p><?=$related_res['catDesc'];?></p>

                                            <div class="clearfix"></div>
                                            <a href="<?=site_url;?>/<?=getValidFileName($related_res['catName']);?>.htm" class="read_more_product" title="Read More">Read More <i class="fa fa-long-arrow-right fa-1x"></i></a>
                                        </div>
                                    </div>
                                </div>
                            </div>
<?php } ?>

                        </div>
                    </div>
                </div>


            </div>
        </div>
    </section>

    <!-- Home Testimonials -->
    <section class="home_testimonials_webpulse">
        <?php include "testimonial.php";?>
    </section>


    <!-- Home Clients -->
    <!-- <section class="webpulse_home_clients">
    <?php // include "our-clients.php";?>
    </section> -->


    <?php include "app_footer.php";?>
    <?php include "app_bottom.php";?>
</body>

</html>
<?php } else { 
    header("Location: ".site_url);

    exit;
} ?>