aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/base.htm2
-rw-r--r--src/phorkie/Database.php4
-rw-r--r--www/www-header.php1
3 files changed, 6 insertions, 1 deletions
diff --git a/data/templates/base.htm b/data/templates/base.htm
index 906453e..8c6b4b0 100644
--- a/data/templates/base.htm
+++ b/data/templates/base.htm
@@ -23,11 +23,13 @@
<li>
<a href="/list">List all</a>
</li>
+ {% if db.adapter %}
<li>
<form class="navbar-search pull-left" action="/search" method="get">
<input type="text" class="search-query" name="q" placeholder="Search" value="{{query}}"/>
</form>
</li>
+ {% endif %}
</ul>
</div>
</div>
diff --git a/src/phorkie/Database.php b/src/phorkie/Database.php
index 786cfe0..1f214e8 100644
--- a/src/phorkie/Database.php
+++ b/src/phorkie/Database.php
@@ -3,12 +3,14 @@ namespace phorkie;
class Database
{
+ public $adapter = null;
public $prefix = '\phorkie\Database_Adapter_Null';
public function __construct()
{
if ($GLOBALS['phorkie']['cfg']['elasticsearch'] != '') {
- $this->prefix = '\phorkie\Database_Adapter_Elasticsearch';
+ $this->adapter = 'Elasticsearch';
+ $this->prefix = '\phorkie\Database_Adapter_Elasticsearch';
}
}
public function getSearch()
diff --git a/www/www-header.php b/www/www-header.php
index c0b18d3..72a2e67 100644
--- a/www/www-header.php
+++ b/www/www-header.php
@@ -63,6 +63,7 @@ function render($tplname, $vars)
$vars['css'] = $GLOBALS['phorkie']['cfg']['css'];
$vars['title'] = $GLOBALS['phorkie']['cfg']['title'];
$vars['topbar'] = $GLOBALS['phorkie']['cfg']['topbar'];
+ $vars['db'] = new Database();
$template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
echo $template->render($vars);