aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-02-01 09:54:32 +0200
committerSyndamia <kamen@syndamia.com>2025-02-01 10:28:22 +0200
commit5a0d4f4a00c9162fbf773ca6b73d34354c6650fe (patch)
treed1bb3d750c295916fc393d671afeba6276185d85 /controllers
parentd6212a96b01d855c49da58a085c07cf540654db7 (diff)
downloadnowayforward_human-5a0d4f4a00c9162fbf773ca6b73d34354c6650fe.tar
nowayforward_human-5a0d4f4a00c9162fbf773ca6b73d34354c6650fe.tar.gz
nowayforward_human-5a0d4f4a00c9162fbf773ca6b73d34354c6650fe.zip
feat(archive): Include topbar dynamically
So now changes to views/archive/topbar.php and views/archive/topbar.css will "propagate" to all archives, no matter when they were made
Diffstat (limited to 'controllers')
-rw-r--r--controllers/archive.php18
1 files changed, 8 insertions, 10 deletions
diff --git a/controllers/archive.php b/controllers/archive.php
index c1ff4a2..9b8ac16 100644
--- a/controllers/archive.php
+++ b/controllers/archive.php
@@ -354,13 +354,6 @@ class DownloadPage {
}
}
- function getArchiveTop() : array {
- return array(
- file_get_contents(__DIR__ . '/../views/archive/topbar.php'),
- file_get_contents(__DIR__ . '/../views/archive/topbar.css')
- );
- }
-
function createArchive($simular_pages) : void {
// Creates the folder with the correct resources and the main html page in a index.html tag
$dom = new DOMDocument();
@@ -382,12 +375,17 @@ class DownloadPage {
$this->changeHyperlinkToLocal($dom, 'a', 'href');
// Add the header for the archives
- list($archive_top, $archive_top_style) = $this->getArchiveTop();
- $phpTag = $dom->createElement('script', $archive_top);
+ $phpTag = $dom->createElement('script', '
+ </script>
+ <?php require_once "' . __DIR__ . '/../views/archive/topbar.php" ?>
+ <script>
+ ');
$body = $dom->getElementsByTagName('body')->item(0);
$body->appendChild($phpTag);
- $styleTag = $dom->createElement('style', $archive_top_style);
+ $styleTag = $dom->createElement('link', '');
+ $styleTag->setAttribute('rel', 'stylesheet');
+ $styleTag->setAttribute('href', '/archive/topbar.css');
$head = $dom->getElementsByTagName('head')->item(0);
$head->appendChild($styleTag);