fixed template rendering

fixed asset controller
This commit is contained in:
Maurice Grönwoldt 2020-09-11 20:22:26 +02:00
parent c33bb4cb3a
commit a087af311c
5 changed files with 9 additions and 12 deletions

View File

@ -8,9 +8,6 @@ html, body {
color: #fff; color: #fff;
background-color: #333; background-color: #333;
font-family: sans-serif; font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh; height: 100vh;
width: 100vw; width: 100vw;
} }

View File

@ -53,9 +53,6 @@ class Language
if (!isset($this->languages[$this->language])) { if (!isset($this->languages[$this->language])) {
return $key; return $key;
} }
if (isset($this->languages[$this->language][$key])) { return $this->languages[$this->language][$key] ?? $key;
return $this->languages[$this->language][$key];
}
return $key;
} }
} }

View File

@ -61,7 +61,7 @@ class Asset
usort($this->jsFiles, function ($a, $b) { usort($this->jsFiles, function ($a, $b) {
return $a['pos'] <=> $b['pos']; return $a['pos'] <=> $b['pos'];
}); });
$theme = $this->getPath('/theme/' . Config::getInstance()->getRenderer()['theme'] . '/js/'); $theme = $this->getPath('/theme/' . Config::getInstance()->getRenderer()->theme . '/js/');
foreach ($this->jsFiles as $key => $file) { foreach ($this->jsFiles as $key => $file) {
echo '<script src="' . $theme . $file['file'] . '" id="js-' . $key . '"></script>'; echo '<script src="' . $theme . $file['file'] . '" id="js-' . $key . '"></script>';
} }

View File

@ -25,6 +25,6 @@ class TestController implements RenderController
public function getTemplate(): string public function getTemplate(): string
{ {
return 'base.php'; return 'base';
} }
} }

View File

@ -20,12 +20,15 @@ $lang = $reg->getLang();
</head> </head>
<body> <body>
<header> <header>
<?=$lang->getTranslation("HEADLINE")?> <?= $lang->getTranslation("HEADLINE") ?>
</header> </header>
<?php <main>
<?php
$lang->getTranslation("TEST_TRANSLATION"); $lang->getTranslation("TEST_TRANSLATION");
echo $this->templateData; echo $this->templateData;
?> ?>
</main>
<?php <?php
Asset::get()->renderJS(); Asset::get()->renderJS();
?> ?>