<?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($dbconn, $query);
$wnum=mysqli_num_rows($sql_dds);
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <title><?=$keyword;?></title>
   <meta name="description" content="<?=$keyword;?>" />
    <meta name="keywords" content="<?=$keyword;?>" />
    
    <?php include "app_top.php"; ?>
</head>

<body>

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

    <section class="heading_banner" style="background-image: url(<?=theme_url; ?>/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">Search Result For "<?=$keyword;?>"</h1>
                    <div class="clearfix"></div>
                   
                </div>
            </div>
        </div>
    </section>

    <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>
                        <li class="active"> Search Category</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <section class="category_page">
        <div class="container">
             <?php
$num=mysqli_num_rows($sql_dds);
if($num > 0) { ?>
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="searchHeading">
                        <h2>Search Result For "<?=$keyword;?>"</h2>
                    </div>
                </div>
                   
  <?php while($row=mysqli_fetch_array($sql_dds)){
  if ($row['catImage'] != '') {
                                            $img_link = getImage($row[catImage], 324, 324, $row[catName], "/uploaded-files/category/images/");
                                            $img_link1 = getImage($row[catImage], 500, 500, $row[catName], "/uploaded-files/category/images/");
                                        } else {
                                            $img_link = NO_IMG_URL;
                                            $img_link1 = NO_IMG_URL;
                                        } ?>
                <div class="col-xxl-4 col-xl-4 col-lg-4 col-md-4 col-sm-6 col-12">
                    <div class="blog-2">
                        <div class="blog-photo clip-home">
                            <img src="<?=$img_link;?>" alt="<?php echo $row['catName'];?>" title="<?php echo $row['catName'];?>" class="img-fluid">
                        </div>
                        <div class="detail">
                            <h4 class="text-center"><a href="<?=site_url;?>/<?=getValidFileName($row['catName']);?>.htm"  title="<?php echo $row['catName'];?>"><?php echo $row['catName'];?></a></h4>
                            <a href="<?=site_url;?>/<?=getValidFileName($row['catName']);?>.htm" class="moreBtn searchmorebtn">Read More</a>
                        </div>
                    </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>
    </section>


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

</body>

</html>