Implement front end location/time/weather etc

This commit is contained in:
Dale Davies
2022-02-08 23:05:56 +00:00
parent 36f44fb266
commit 6d5366147f
19 changed files with 275 additions and 150 deletions

View File

@@ -5,14 +5,12 @@ namespace Jump;
class Main {
private Cache $cache;
private Greeting $greeting;
private \Mustache_Engine $mustache;
private array $outputarray;
private Sites $sites;
public function __construct() {
$this->config = new Config();
$this->greeting = new Greeting();
$this->mustache = new \Mustache_Engine([
'loader' => new \Mustache_Loader_FilesystemLoader($this->config->get('templatedir'))
]);
@@ -25,15 +23,8 @@ class Main {
return $template->render([
'noindex' => $this->config->parse_bool($this->config->get('noindex')),
'sitename' => $this->config->get('sitename'),
'latlong' => $this->config->get('latlong'),
'owmapikey' => $this->config->get('owmapikey')
]);
}
private function render_greeting(): string {
$template = $this->mustache->loadTemplate('greeting');
return $template->render([
'greeting' => $this->greeting->get_greeting(),
'latlong' => $this->config->get('latlong', false),
'owmapikey' => $this->config->get('owmapikey', false)
]);
}
@@ -55,7 +46,6 @@ class Main {
public function build_index_page(): void {
$this->outputarray = [
$this->render_header(),
$this->render_greeting(),
$this->render_sites(),
$this->render_footer(),
];