diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index 8da362561..8cb66daf8 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -42,9 +42,7 @@ class Search extends Controller {
$observer = App::get_observer();
$observer_hash = (($observer) ? $observer['xchan_hash'] : '');
- $o = '
' . "\r\n";
-
- $o .= '
' . t('Search') . '
';
+ $title = t('Search');
if (x(App::$data, 'search'))
$search = trim(App::$data['search']);
@@ -57,7 +55,7 @@ class Search extends Controller {
$search = ((x($_GET, 'tag')) ? trim(escape_tags(rawurldecode($_GET['tag']))) : '');
}
- $o .= search($search, 'search-box', '/search', ((local_channel()) ? true : false));
+ $searchbox = search($search, 'search-box', '/search', ((local_channel()) ? true : false));
if (local_channel() && str_starts_with($search, 'https://') && !$update && !$load) {
@@ -121,8 +119,17 @@ class Search extends Controller {
goaway(z_root() . '/directory' . '?f=1&navsearch=1&search=' . $search);
}
- if (!$search)
- return $o;
+ if (!$search) {
+ $tpl = get_markup_template('search.tpl');
+
+ return replace_macros($tpl, [
+ '$title' => $title,
+ '$searchbox' => $searchbox,
+ '$livesearch' => '',
+ '$results_header' => '',
+ '$conversation' => '',
+ ]);
+ }
if ($tag) {
$wildtag = str_replace('*', '%', $search);
@@ -149,8 +156,8 @@ class Search extends Controller {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
- $o .= '
' . "\r\n";
- $o .= "\r\n";
App::$page['htmlhead'] = replace_macros(get_markup_template("build_query.tpl"), [
@@ -254,15 +261,21 @@ class Search extends Controller {
}
if ($tag)
- $o .= '
' . sprintf(t('Items tagged with: %s'), $search) . '
';
+ $results_header = sprintf(t('Items tagged with: %s'), $search);
else
- $o .= '
' . sprintf(t('Search results for: %s'), $search) . '
';
+ $results_header = sprintf(t('Search results for: %s'), $search);
- $o .= conversation($items, 'search', $update, 'client');
+ $conversation = conversation($items, 'search', $update, 'client');
- $o .= '
';
+ $tpl = get_markup_template('search.tpl');
- return $o;
+ return replace_macros($tpl, [
+ '$title' => $title,
+ '$searchbox' => $searchbox,
+ '$livesearch' => $livesearch,
+ '$results_header' => $results_header ?? '',
+ '$conversation' => $conversation,
+ ]);
}
diff --git a/view/tpl/search.tpl b/view/tpl/search.tpl
new file mode 100644
index 000000000..210082d64
--- /dev/null
+++ b/view/tpl/search.tpl
@@ -0,0 +1,15 @@
+