From a6f4802254ed1291e769a8fce3b8cf031063586f Mon Sep 17 00:00:00 2001 From: Anthony Kolber Date: Wed, 28 Aug 2013 16:41:51 +1000 Subject: [PATCH] Add a basic example of a search page --- app/cache.inc.php | 2 +- content/search/search.txt | 3 +++ templates/search.html | 42 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 content/search/search.txt create mode 100644 templates/search.html diff --git a/app/cache.inc.php b/app/cache.inc.php index 978f958e..e7750a8f 100644 --- a/app/cache.inc.php +++ b/app/cache.inc.php @@ -75,7 +75,7 @@ function create_full_cache($pages = null) { if ($page['is_folder']) { $current_page = AssetFactory::get($page['path']); # Skip for password protected pages - if ($current_page['password_protect'] || $current_page['hide_from_search']) continue; + if (isset($current_page['password_protect']) || isset($current_page['hide_from_search'])) continue; # Only save search field data foreach ($current_page as $key => $value) { if (!in_array($key, $search_fields)) unset($current_page[$key]); diff --git a/content/search/search.txt b/content/search/search.txt new file mode 100644 index 00000000..cd55287b --- /dev/null +++ b/content/search/search.txt @@ -0,0 +1,3 @@ +bypass_cache: true +title: Search Results + diff --git a/templates/search.html b/templates/search.html new file mode 100644 index 00000000..dfb2ce98 --- /dev/null +++ b/templates/search.html @@ -0,0 +1,42 @@ + + + + + {{ page.title }}, {{ page.name }}'s Portfolio + + + + +
+

+ {{ page.name }} + {{ page.profession }} +

+ {{ page.email }} +
+ {% include 'partials/navigation/navigation.html' %} +
+

+
+

{{ page.title }}

+
+ +
+ {% set results = search(page.query.q) %} + {% for result in results %} + +

{{ result.title }}

+

{{ result.search_match }}

+
+
+ {% endfor %} +
+
+
+ +
+ + +