-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
55 lines (34 loc) · 1014 Bytes
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
$pageTitle = "Inzu - Search";
// Load Includes
require("lib/core/functions.php");
require("lib/core/config.php"); // This is where your API Key is stored
require("template/template_start.php"); // Your site template start
// Inputs
$search = preg_replace("/[^a-zA-Z0-9[:blank:][:space:]]/", "", @$_REQUEST['search']);
// Results
$inzu = INZU_GET("functions/search", array("search"=>$search));
foreach ( $inzu->data as $entry ) {
if( $entry->zone == "about" ) {
$link = "about.php?";
} else if ( $entry->zone == "articles" ) {
$link = "articles.php?entry_id=".$entry->entry_id;
} else if ( $entry->zone == "news" ) {
$link = "news.php?entry_id=".$entry->entry_id;
}
$results.=<<<EOD
<div>
<h2>{$entry->title}</h2>
<p>{$entry->preview}</p>
</div>
+ <a href="{$link}">View</a>
<hr>
EOD;
}
if ( !$results ) $results = "<p>Try using the phrase \"test\" to find a result.</p>";
echo<<<EOD
<h2>Search results</h2>
<hr/>$results
EOD;
require("template/template_end.php");
?>