This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/themes/futaba/page.class.php

66 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace Shimmie2;
class Page extends BasePage
{
public function body_html(): string
{
$left_block_html = "";
$main_block_html = "";
$sub_block_html = "";
foreach ($this->blocks as $block) {
switch ($block->section) {
case "left":
$left_block_html .= $block->get_html(true);
break;
case "main":
$main_block_html .= $block->get_html(false);
break;
case "subheading":
$sub_block_html .= $block->body;
break;
default:
print "<p>error: {$block->header} using an unknown section ({$block->section})";
break;
}
}
if (empty($this->subheading)) {
$subheading = "";
} else {
$subheading = "<div id='subtitle'>{$this->subheading}</div>";
}
if ($this->left_enabled) {
$left = "<nav>$left_block_html</nav>";
$withleft = "withleft";
} else {
$left = "";
$withleft = "";
}
$flash_html = $this->flash_html();
$footer_html = $this->footer_html();
return <<<EOD
<header>
<h1>{$this->heading}</h1>
$subheading
$sub_block_html
</header>
$left
<article class="$withleft">
$flash_html
$main_block_html
</article>
<footer>
<hr>
$footer_html
</footer>
EOD;
}
}