File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/nec-enterprise.com/pages/page.search.php
<?php
echo '<div class="header-spacer"></div>';
/*
* Do Search with post values
*/
$pars = array("product");//,"description"
$search_values = $_GET["product"];
/*
* Get data
*/
$view_page = isset($_GET["show"]) ? $_GET["show"] : 1;
//$search_entries = $cassette->getSearchResults("td_products",$pars,$search_values,$refine_search,$view_page);
$tables = array("td_page");
$pars = array("title","subtitle");
$search_values = $_GET["q"];
$search_entries = $cassette->search($tables,$pars,$search_values);
//d($search_entries);
/*
* Search Results
*/
$rslt = '';
foreach((array) $search_entries as $se)
{
$rslt .= '<div class="col24 result-row">';
$rslt .= '<h4><a href="'. $se->entry_link .'">'. $se->title .'</a></h4>'; //'. $se->score .'
$rslt .= '<p><em>'. preg_replace("/http:\/\//","",$cassette->base) . $se->entry_link .'</em></p>';
$rslt .= '<p>'.makeIntro($se->contents,240,null,' ...').'</p>';
$rslt .= '</div>';
}
/*
* Show products && pagination
*/
if(count($search_entries) > 0)
{
$html = '<div class="search-products"><form class="form col24" action="search" method="get"><div>';
$html .= '<h2>Search results</h2>';
$html .= '<div class="col24 sub-grid">';
$html .= '<input type="text" name="q" value="'. outputSafe($_GET["q"]) .'" id="q" class="input autocomplete" placeholder="Search products, solutions, news"/>';
$html .= '<button type="submit" class="button primary">Search</button>';
$html .= '</div>';
$html .= '</div></form></div>';
$html .= $rslt;
// pagination
$page_link = 'search?product='. vl($_GET["product"]) .'&industry='. $_GET["industry"] .'&quantity='.$_GET["quantity"];
$current_page = (isset($_REQUEST["show"])) ? $_REQUEST["show"] : 1;
$hide_first = false;
$hide_last = false;
$html .= '<ul class="pagination col24">';
$start = $hemetrading->product_pagination > 20 ? $_REQUEST["show"]-10 : 1;
$end = $hemetrading->product_pagination > 20 ? ($_REQUEST["show"]+10) : $hemetrading->product_pagination;
if($start <= 1)
{
$hide_first = true;
$start = 1;
}
if($end >= $hemetrading->product_pagination)
{
$hide_last = true;
$end = $hemetrading->product_pagination;
}
if($hide_first == false) $html .= '<li><span class="disabled">...</span></li>';
for($i=$start; $i<= $end; $i++)
{
if(isset($_REQUEST["show"]) && $_REQUEST["show"] == $i || !isset($_REQUEST["show"]) && $i == 1) $html .= '<li><span class="current">'.$i.'</span></li>';
else $html .= '<li><a href="'.$page_link.'&show='.$i.'">'.$i.'</a></li>';
}
if($hide_last == false) $html .= '<li><span class="disabled">...</span></li>';
$html .= '</ul>';
}
/*
* Output to page
*/
echo $cassette->wrapAsSection($html,"","search-products-results");
?>