<?php 
include_once("include/main.inc.php"); 
session_start();
$sesion=session_id();
@extract($_GET);
@extract($_POST);
@extract($_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['dbconn'],$query);
$wnum=mysqli_num_rows($sql_dds);
$page_metatitle = "Search - ".COMPANY_NAME;
$page_metakey = "Search - ".COMPANY_NAME;
$page_metadesc = "Search - ".COMPANY_NAME;
?>
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php include "app_top.php"; ?>
</head>

<body>
    <?php include "app_header.php"; ?>
    <div class="small-banner py-4 heading_banner position-relative">
        <div class="text-center position-relative z-index-9">
            <h1 class="cat_title">Search</h1>
            <div class="clearfix"></div>
        </div>
    </div>
    <nav aria-label="breadcrumb" class="py-0 position-relative z-index-9 bg-light-light border-bottom">
        <div class="container-fluid px-4 py-2">
            <ol class="breadcrumb mb-0">
                <li class="breadcrumb-item"><a href="<?=site_url;?>" class="text-dark">Home</a></li>
                <li class="breadcrumb-item active text-orange" aria-current="page">Search</li>
            </ol>
        </div>
    </nav>
    <section class="  w-100 bg-light py-5 product-details">
        <div class="container-fluid px-4">
            <div class="title1 text-center fs-30">Search Result For " <?php echo "  " . $keyword." (".$wnum.") "; ?> "
            </div>
            <div class="border-bottom border-3 w-100px border-primary mx-auto pt-1 mb-3"></div>



            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="wps_featured1 row">
                        <?php
                            $num=mysqli_num_rows($sql_dds);
                            if($num > 0) { 
                                while($row=mysqli_fetch_array($sql_dds)){ 
                            if($row['catImage'] != ''){
                                $img_link = getImage($row[catImage], 252, 252, $row[catName],"/uploaded-files/category/images/");
                                $img_link1 = getImage($row[catImage], 350, 350, $row[catName],"/uploaded-files/category/images/");
                            }else{
                                $img_link = NO_IMG_URL;
                                $img_link1 = NO_IMG_URL;
                            }
                        ?>
                        <div class="feature_item col-lg-3 col-md-6 wow fadeInDown" data-wow-delay=".2s">
                            <div class="inner-box w-100 p-0 mb-3">
                                <div class="image-box">
                                    <figure class="image"><img src="<?= $img_link;?>"
                                            alt="<?= $row['displayName'];?> in <?=$admin_res['targetlocation'];?>"
                                            title="<?= $row['displayName'];?> in <?=$admin_res['targetlocation'];?>">
                                    </figure>
                                    <div class="overlay-link">
                                        <a href="<?=site_url;?>/<?=getValidFileName($row['catName']);?>.htm"
                                            title="<?= $row['displayName'];?> in <?=$admin_res['targetlocation'];?>"
                                            class="lightbox-image">
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                                                fill="currentColor" viewBox="0 0 16 16">
                                                <path fill-rule="evenodd"
                                                    d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z" />
                                                <path fill-rule="evenodd"
                                                    d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z" />
                                            </svg>
                                        </a>
                                    </div>
                                </div>
                                <div class="lower-content px-1">
                                    <h4><a href="<?=site_url;?>/<?=getValidFileName($row['catName']);?>.htm"
                                            title="<?= $row['displayName'];?> in <?=$admin_res['targetlocation'];?>"><?= $row['displayName'];?></a>
                                    </h4>

                                    <div
                                        class="d-flex align-items-center  justify-content-between1 justify-content-center">
                                        <a href="<?=site_url;?>/<?=getValidFileName($row['catName']);?>.htm"
                                            class="read_more_product read_more_btn_2 mb-3"
                                            title="<?= $row['displayName'];?> in <?=$admin_res['targetlocation'];?>">Read
                                            More <i class="fa fa-long-arrow-right fa-1x"></i></a>
                                        <a class="read_more_product read_more_btn_2 mx-0 mx-2 mb-3"
                                            href="javascript:void(0);" data-bs-toggle="modal"
                                            data-bs-target="#productID"
                                            onclick="$('.catID').val('<?php echo $row['catID'];?>');
                                                     $('.catName').html('<?php echo $row['catName'];?>');
                                                     $('.catImg').attr('src','<?= $img_link1;?>'); 
                                                     $('.catImg').attr('alt','<?= $row['displayName'];?> in <?=$admin_res['targetlocation'];?>'); 
                                                     $('.catImg').attr('title','<?= $row['displayName'];?> in <?=$admin_res['targetlocation'];?>');"
                                            title="Get Best Quote">
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
                                                fill="currentColor" viewBox="0 0 16 16">
                                                <path
                                                    d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555ZM0 4.697v7.104l5.803-3.558L0 4.697ZM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757Zm3.436-.586L16 11.801V4.697l-5.803 3.546Z">
                                                </path>
                                            </svg>
                                            Get Best Quote
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php } } else {?>
                        <div style="text-align:center;">
                            <div class="alert alert-danger" style="display: inline-block;width: 600px;">
                                <strong>You Search for "<u><?=$keyword;?></u>" Not Matched, Please Try with
                                    Another
                                    Keywords</strong>
                            </div>
                        </div>


                    </div>
                    <?php } ?>
                </div>
            </div>
        </div>
      
    </section>
    <?php include "app_footer.php"; ?>
    <?php include "app_bottom.php"; ?>





</body>

</html>