<!DOCTYPE html >
<html lang="en">
<head>
  <title><%site_title%>: Search Results</title>
<%include include_common_head.html%>
</head>
<body id="home">
  <%~if ad_wallpaper%>
  <%ad_wallpaper%>
  <%~endif%>
  <div class="container">
    <%include include_header.html%>

    <div class="main">
      <div class="contentwrapper clearfix">
        <%include include_breadcrumb.html%>
        <section class="section category-list section-has-widgets remove-sidebar">
        <div class="sidebar-b">
          <%~set adsize = '300x600'%>
          <%include include_ad.html%>
          <%~set widgets_loop = Plugins::UI::fetch_widgets('search_results')%>
          <%~set widget_end   = $widgets_loop.length%>
          <%include include_widgets.html%>
        </div>
        <div class="content search-results content-has-widgets">
          <div lass="grid">
            <div class="clearfix">
              <h1 class="float-left">Search Results</h1>
              <a href="<%config.db_cgi_url%>/search.cgi" class="btn btn-white float-right">Advanced Search</a>
            </div>
            <p>Your search<%if query%> for <%if highlight%><%set equery = escape_html $query%><%Links::Tools::highlight($equery, $equery)%><%else%><strong><%escape_html query%></strong><%endif%><%endif%> returned <strong><%cat_hits%></strong> categor<%if cat_hits != 1%>ies<%else%>y<%endif%> and <strong><%link_hits%></strong> link<%if link_hits != 1%>s<%endif%></p>
            <%if category_results_loop.length~%>

            <h3 class="section-title">Categories</h3>
            <ul>
            <%~loop category_results_loop%>
            <%~set formatted_title = Links::Utils::format_title($title_loop, separator => ' > ', no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>
              <li><%if highlight and query%><%Links::Tools::highlight($formatted_title, $query)%><%else%><%formatted_title%><%endif%></li>
            <%~endloop%>
            </ul>
            <%~endif%>

            <%~if link_results_loop.length~%>
            <%~if paging.num_hits > $paging.max_hits%>
            <div class="toolbar-b">
              <h3 class="section-title">Links</h3>
              <%~set page_button = 'page_button2'%>
              <%include include_paging.html%>
            </div>
            <%~endif%>
            <%~set search_results_categories = get_links_categories($link_results_loop) %>
            <%loop link_results_loop~%>
            <%if title_loop.length%>
              <%~set formatted_title = Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>
              <p class="category"><%if highlight and query%><%Links::Tools::highlight($formatted_title, $query)%><%else%><%formatted_title%><%endif%></p>
            <%~endif%>
            <%~rewrite_detail_url%>
            <%~set thumbnail_url = Plugins::UI::fetch_thumbnail($loop_value)%>
            <%include link.html%>
            <%~endloop%>
            <%~if paging.num_hits > $paging.max_hits%>
            <div class="toolbar right">
                <%~set page_button = 'page_button2'%>
                <%include include_paging.html%>
            </div>
            <%~endif%>
            <%~endif%>
          </div>
        </div><!-- end content -->
        </section><!-- end section -->
        <div class="section-spacer"></div>

      </div><!-- End contentwrapper -->
    </div>
    <%include include_footer.html%>
  </div>
</body>
<%~include include_global_js.html%>