config.inc.php: ✨ Search engine config options
authorMalte Bublitz <malte@rolltreppe3.de>
Fri, 2 May 2025 19:48:40 +0000 (21:48 +0200)
committerMalte Bublitz <malte@rolltreppe3.de>
Fri, 2 May 2025 19:48:40 +0000 (21:48 +0200)
The search engine can now be specified in config.inc.php, and you
can now set a custom SearXNG instance.

config.inc.php
index.php
template.inc.php

index 014e9e536348e25e747d58ba3a7f8bda63dd3602..81311b5fd00af62f5835d54d5d6335bb66483726 100644 (file)
@@ -1,5 +1,33 @@
 <?php
+/**
+ * Configuration for `startseite.malte70.de`
+ */
 
+
+
+/**
+ * Search engine type
+ * 
+ * Valid values: "Google" | "searX"
+ */
+//$SearchEngine = "Google";
+$SearchEngine = "searX";
+
+
+/**
+ * Search engine "searX": Instance
+ */
+//$SearchSearXInstance = "https://searxng.world";
+$SearchSearXInstance = "https://searx.rt3x.de";
+
+/**
+ * Website links
+ * 
+ * - `$Links` is an array containing an Array of website links for each line to display.
+ * - Each website link is an Array containing two strings:
+ *   The link's title and URL
+ * 
+ */
 $Links = Array();
 $Links[] = Array(
 //     Array("twitter",          "https://twitter.com"                        ),
@@ -29,4 +57,3 @@ $Links[] = Array(
        Array("mdn",              "https://developer.mozilla.org/de/"          ),
 );
 
-?>
index 6df08246a642f33751d2c0d4d2a6e2e558f62a89..d501d87df242a9772d9f5458f35c76172597ad5a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -40,7 +40,7 @@ $Data = Array(
                //"js/settings.js",
                "js/main.js"     // onLoad logic
        ),
-    "Search"  => "searX", // Google/searX
+       "Search"  => $SearchEngine, // Google/searX
        "Footer"  => Array(
                "CopyrightYear" => date("Y"),
                "AuthorName"    => "malte70",
index 7e1fcdba34779a53c8f04cfcd26a361a75601a21..325844592232b6d0bfb7e4c515602c93486671e3 100644 (file)
@@ -18,11 +18,11 @@ header("Content-Type: text/html; charset=".$Data["Meta"]["Charset"]);
  * this array using `array_rand()`
  */
 $search_placeholders = Array(
-    "something",
-    "the answer",
-    "42",
-    "foo bar",
-    "awesome stuff"
+       "something",
+       "the answer",
+       "42",
+       "foo bar",
+       "awesome stuff"
 );
 $i = array_rand($search_placeholders);
 $placeholder = $search_placeholders[$i];
@@ -133,7 +133,7 @@ if (in_array($_SERVER["REMOTE_ADDR"], array("::0", "127.0.0.1"))) {
 
 <?php else: ?>
                        <section id="google-search">
-                <form action="https://searx.rt3x.de/search" method="GET">
+                               <form action="<?=$SearchSearXInstance?>/search" method="GET">
                                        <p>
                                                <!--<span class="red">//</span>-->
                                                <span class="red">find</span>
@@ -194,7 +194,7 @@ foreach ($Data["Links"] as $LinkRow) {
                                <a id="settings_dialog_show" href="javascript:whoami.settings2();">Settings v2</a>
                        <p>
 */ ?>
-                   <p>
+                       <p>
                                <button type="button" id="settings">Settings&hellip;</button>
                        </p>
                        <p>