commit d33ae49e9cbba6bcda5ceeb0020c1b09acd3c409
parent e6a1fe0054eaa705acdba12b4348b7d7d8ead91e
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Fri, 18 Oct 2024 10:45:19 +0200
feat: use random entry in examples
Diffstat:
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/index.php b/index.php
@@ -295,8 +295,8 @@
<section id="faqs">
<?php
- /* Used within examples */
- $fsi = array_key_first($searches);
+ /* Random entry from search array: used within examples below */
+ $rsi = array_rand($searches, 1);
?>
<h3>About serĉi</h3>
@@ -329,14 +329,14 @@
<p>
For example, you can conduct a search on the website
<a
- href="<?php echo $searches[$fsi]["website"]; ?>"
+ href="<?php echo $searches[$rsi]["website"]; ?>"
target="_blank"
>
- <?php echo $searches[$fsi]["name"]; ?>
+ <?php echo $searches[$rsi]["name"]; ?>
</a>
directly from <?php echo $_SERVER["SERVER_NAME"]; ?> by adding
the keyword
- <code>!<?php echo $searches[$fsi]["keywords"][0]; ?></code> to
+ <code>!<?php echo $searches[$rsi]["keywords"][0]; ?></code> to
your search query.
</p>
<p>
@@ -351,19 +351,19 @@
<code>default_search</code> URL parameter. For example, if you
wanted to use
<a
- href="<?php echo $searches[$fsi]["website"]; ?>"
+ href="<?php echo $searches[$rsi]["website"]; ?>"
target="_blank"
>
- <?php echo $searches[$fsi]["name"]; ?>
+ <?php echo $searches[$rsi]["name"]; ?>
</a>
as your default search, you can simply add
- <code>/?default_search=<?php echo $fsi; ?></code> to the serĉi
+ <code>/?default_search=<?php echo $rsi; ?></code> to the serĉi
URL:
<br>
- <a href="/?default_search=<?php echo $fsi; ?>">
+ <a href="/?default_search=<?php echo $rsi; ?>">
<?php
echo "https://" . $_SERVER["SERVER_NAME"] .
- "/?default_search=" . $fsi;
+ "/?default_search=" . $rsi;
?>
</a>
</p>
@@ -404,16 +404,16 @@
you do not want serĉi to store any cookie on your device. For
example, if you wanted to use
<a
- href="<?php echo $searches[$fsi]["website"]; ?>"
+ href="<?php echo $searches[$rsi]["website"]; ?>"
target="_blank"
>
- <?php echo $searches[$fsi]["name"]; ?>
+ <?php echo $searches[$rsi]["name"]; ?>
</a>
as your default search, you could use following search-URL:
</p>
<pre><?php
echo "https://" . $_SERVER["SERVER_NAME"] .
- "/?default_search=" . $fsi . "&q=%s";
+ "/?default_search=" . $rsi . "&q=%s";
?></pre>
</section>