{% extends theme/search-results.html %} {% block title %} {{ $query }} - Search Results {% endblock %} {% block navigation %} {% endblock %} {% block content %} {% if(strlen($query) > 3) { $searchResultsQuery = $db->query("select articles.id, articles.category_id, articles.slug as slug, articles.title as title, articles.excerpt as excerpt, articles.image as image, articles.created as created, authors.name as authorname, authors.linkedin as linkedin, authors.slug as authorslug, categories.name as category_name, categories.slug as category_slug from articles, authors, categories where articles.author_id = authors.id and articles.category_id = categories.id and (articles.html LIKE '%" . $query . "%' OR articles.title LIKE '%" . $query . "%') ORDER BY articles.created DESC"); $searchCheckQuery = $db->query("select count(articles.id) as count, articles.id, articles.category_id, articles.slug as slug, articles.title as title, articles.excerpt as excerpt, articles.image as image, articles.created as created, authors.name as authorname, authors.linkedin as linkedin, authors.slug as authorslug, categories.name as category_name, categories.slug as category_slug from articles, authors, categories where articles.author_id = authors.id and articles.category_id = categories.id and (articles.html LIKE '%" . $query . "%' OR articles.title LIKE '%" . $query . "%') ORDER BY articles.created DESC"); $numRowsArray = $searchCheckQuery->fetchArray(); $numRows = $numRowsArray['count']; if($numRows > 0) { while($searchResults = $searchResultsQuery -> fetchArray(SQLITE3_ASSOC)){ %}
{{ $searchResults['category_name'] }}

{{ $searchResults['title'] }}

{{ $searchResults['excerpt'] }}

{{ date("d F, Y", strtotime($searchResults['created'])) }}

{% } } else { %}

No articles matching your criteria found

{% } } else { %}

Query is too short

{% } %} {% endblock %}