<?php
include_once("include/main.inc.php");
session_start();
$sesion=session_id();
@extract($_GET);
@extract($_POST);
@extract($_REQUEST);
//print_r($_REQUEST);
$chunk = $_REQUEST['keyword'];
$chunk = substr($chunk, 0, 5);

if(!empty($keyword)){
	$query =" SELECT * FROM category_tbl WHERE catName LIKE '%".$keyword."%' or catName LIKE '%".$chunk."%' or displayName LIKE '%".$chunk."%'";
}else{
   $query = "SELECT * FROM category_tbl order by catID desc";
}

$sql_dds = mysqli_query($GLOBALS['dbcon'],$query);
$wnum=mysqli_num_rows($sql_dds);
//echo " You have searched for keywords: " . $keyword." (".$wnum.") ";?>
<!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">
    <title><?=$keyword;?></title>
    <meta name="keywords" content="<?=$keyword;?>" />
    <meta name="description" content="<?=$keyword;?>" />
    <?php include 'components/top_header.php';?>
</head>

<body>
    <div class="webpulse-main-wrapper">
        <!-- Header -->
        <?php include 'components/header.php';?>


        <!-- Heading Banner -->
        <section class="heading_banner" style="background-image: url(<?=SITE_URL_PATH;?>/designer/images/products/products.jpg)">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 text-center">
                        <div class="cat_title">Search result for <strong><?php echo $keyword; ?></strong></div>
                        <div class="clearfix"></div>
                        
                    </div>
                </div>
            </div>
        </section>

        <!-- Breadcrumb -->
        <section class="inner_breadcrumb hidden-xs">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12">
                        <ul class="breadcrumb">
                            <li><a href="<?=SITE_URL_PATH;?>" title="Home">Home</a></li>
                            
                            <li class="active">Search result for <?=$keyword;?></li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>


        <!-- Home About -->
        <section class="about_page">
            <div class="container">
                <div class="row">
                    <div class="col-md-9 col-md-push-3">
                        <div class="right_side">
                            <h1 class="bg-title">Search result for "<?php echo "  " . $keyword." (".$wnum.") "; ?>"</h1>
                            <?php
$num=mysqli_num_rows($sql_dds);
if($num > 0) { ?>



                            <div class="row">
                            <?php while($row=mysqli_fetch_array($sql_dds)){ 
?>
                                <div class="col-lg-4 col-md-4 col-sm-6">
                                <div class="product_more">
                                        <a href="<?=SITE_URL_PATH;?>/<?=getValidFileName($row['catName']);?>.htm" title="<?php echo $row['displayName'];?>">
                                            <div class="may_image">
                                                <div class="image">
                                                    <img src="<?= getImage($row['catImage'], 370, 307, $row['catName'],"/uploaded-files/category/images/");?>"
                                                        alt="<?php echo $row['catName'];?>" title="<?php echo $row['catName'];?>">
                                                </div>
                                            </div>
                                            <div class="may_describe">
                                                <h4><?php echo $row['displayName'];?></h4>
                                                <!--<span>Cushion Cover 001</span>-->
                                                <span></span>
                                                <div class="clearfix"></div>
                                                <button class="may_btn">Read More</button>
                                            </div>
                                        </a>
                                    </div>
                            </div>
                                
<?php } ?>

                                </div>
                                <?php } else {?>
                                    <div style=text-align:center;>
<div class="alert alert-danger" style="display: inline-block;width: 600px;">
<strong>You Search for "<u><?php echo (ucwords($keyword));?></u>" Not Matched, Pls Try with Another Keywords</strong>
</div>
    </div>                  
                            <?php } ?>


                               

                                

                        </div>
                    </div>
                    <div class="col-lg-3 col-md-4 col-lg-pull-9">
                        <div class="left_sidebar">
                            <?php include 'components/quick_contact.php';?>
                        </div>
                        <div class="left_sidebar">
                            <?php include 'components/product_list.php';?>
                        </div>
                    </div>

                </div>
            </div>
        </section>
 
       
        <!-- Home Clients -->
       


        <!-- Footer -->
        <?php include 'components/footer.php';?>
    </div>
    
    <?php include 'components/product_modal.php';?>

    <?php include 'components/bottom_footer.php';?>
</body>

</html>