Added footer page

This commit is contained in:
Jeroen De Meerleer 2023-03-22 14:44:40 +01:00
parent 8df7870753
commit 9e03804a64
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
4 changed files with 18 additions and 5 deletions

View File

@ -19,7 +19,7 @@ class DefaultController extends AbstractController
'header' => $return['header'],
'content' => $return['content'],
'title' => $return['title'],
'nineties' => (isset($_COOKIE['nineties']))
'footer' => $return['footer'],
], $response);
}
@ -32,7 +32,7 @@ class DefaultController extends AbstractController
'header' => $return['header'],
'content' => $return['content'],
'title' => $return['title'],
'nineties' => (isset($_COOKIE['nineties']))
'footer' => $return['footer'],
], $response);
}
}

View File

@ -27,6 +27,14 @@ class Page
throw new NotFoundHttpException('Some required files were not found');
}
if(file_exists($kernel->getCacheDir() . '/pages/_footer.md')) {
$return['footer'] = $parsedown->text(file_get_contents($kernel->getCacheDir() . '/pages/_footer.md'));
} elseif(file_exists($kernel->getCacheDir() . '/pages/_footer.html')) {
$return['footer'] = file_get_contents($kernel->getCacheDir() . '/pages/_footer.html');
} else {
throw new NotFoundHttpException('Some required files were not found');
}
if(file_exists($kernel->getCacheDir() . '/pages/' . $page . '.md')) {
$return['content'] = $parsedown->text(file_get_contents($kernel->getCacheDir() . '/pages/' . $page . '.md'));
} elseif(file_exists($kernel->getCacheDir() . '/pages/' . $page . '.html')) {
@ -35,6 +43,8 @@ class Page
throw new NotFoundHttpException('Some required files were not found');
}
$titles = json_decode(file_get_contents($kernel->getCacheDir() . '/pages/titles.json'), true);
$return['title'] = $titles[$page] ?? '';
$return['status'] = '200';

View File

@ -15,9 +15,7 @@
{% block content %}{% endblock %}
{% block extrahtml %}{% endblock %}
<footer class="footer">
<div class="container">
<span class="text-muted">Design inspired by Dall-E 2</span>
</div>
{% block footer %}{% endblock %}
</footer>
</body>
</html>

View File

@ -25,3 +25,8 @@
{% block scripts %}
{{ encore_entry_script_tags('page') }}
{% endblock %}
{% block footer %}
{{ footer | raw }}
{% endblock %}