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

76 lines
1.8 KiB
PHP
Raw Normal View History

2020-01-26 13:19:35 +00:00
<?php declare(strict_types=1);
2013-06-19 19:09:22 +00:00
class Page extends BasePage
{
public $left_enabled = true;
public function disable_left()
{
$this->left_enabled = false;
}
2020-02-01 18:11:00 +00:00
public function render()
2020-02-01 18:11:00 +00:00
{
$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; // $this->block_to_html($block, true);
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 ? "<b id='flash'>".nl2br(html_escape(implode("\n", $this->flash)))."</b>" : "";
$head_html = $this->head_html();
$footer_html = $this->footer_html();
print <<<EOD
<!doctype html>
<html class="no-js" lang="en">
$head_html
<body>
<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>
</body>
</html>
EOD;
}
2013-06-19 19:09:22 +00:00
}