Add 'online' value for Mustache template

Provide an 'online' value to the Search Result Mustache template. This will, for example, allow you to put things in your Search Result template that will show up when your site is displayed live (PHP), but will not be output when your site is displayed using the offline Javascript, and vice versa.

eg.
{{#online}}
  This will only display in your template if it's online.
{{/online}}
{{^online}}
  This will only display in your template it it's offline.
{{/online}}
This commit is contained in:
Brian Huisman 2023-06-22 09:57:33 -04:00
parent 042339d3ef
commit 47562e0a71
2 changed files with 6 additions and 0 deletions

View file

@ -80,8 +80,12 @@ function os_return_all() {
// Create the Mustache template
let os_TEMPLATE = {
errors: false,
online: false,
version: '{{version}}',
searchable: false,
addError: function(text) {
if (!this.errors) {
this.errors = {};

View file

@ -59,6 +59,8 @@ foreach ($_RDATA['s_latin'] as $char => $latin) {
// {{{{{ Initialize the Mustache templating engine
class OS_Mustache {
public $errors;
public $online = true;
public $version;
public $searchable;