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/warm/layout.class.php

115 lines
2.9 KiB
PHP
Raw Normal View History

2009-07-23 01:32:45 +00:00
<?php
/**
* A class to turn a Page data structure into a blob of HTML
*/
class Layout {
/**
* turns the Page into HTML
2015-09-12 10:43:28 +00:00
*
* @param Page $page
2009-07-23 01:32:45 +00:00
*/
public function display_page(Page $page) {
global $config;
//$theme_name = $config->get_string('theme', 'default');
$site_name = $config->get_string('title');
2009-07-23 01:32:45 +00:00
$data_href = get_base_href();
$main_page = $config->get_string('main_page');
$contact_link = contact_link();
2009-07-23 01:32:45 +00:00
$header_html = "";
ksort($page->html_headers);
foreach($page->html_headers as $line) {
$header_html .= "\t\t$line\n";
2009-07-23 01:32:45 +00:00
}
$left_block_html = "";
$main_block_html = "";
$head_block_html = "";
2010-01-03 09:56:07 +00:00
$sub_block_html = "";
2009-07-23 01:32:45 +00:00
foreach($page->blocks as $block) {
switch($block->section) {
case "left":
2012-03-12 04:39:04 +00:00
$left_block_html .= $block->get_html(true);
2009-07-23 01:32:45 +00:00
break;
case "head":
2012-03-12 04:39:04 +00:00
$head_block_html .= "<td width='250'><small>".$block->get_html(false)."</small></td>";
2009-07-23 01:32:45 +00:00
break;
case "main":
2012-03-12 04:39:04 +00:00
$main_block_html .= $block->get_html(false);
2009-07-23 01:32:45 +00:00
break;
2010-01-03 09:56:07 +00:00
case "subheading":
$sub_block_html .= $block->body; // $this->block_to_html($block, true);
break;
2009-07-23 01:32:45 +00:00
default:
print "<p>error: {$block->header} using an unknown section ({$block->section})";
break;
}
}
$debug = get_debug_info();
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
/*$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
2009-07-23 01:32:45 +00:00
$wrapper = "";
if(strlen($page->heading) > 100) {
$wrapper = ' style="height: 3em; overflow: auto;"';
}
*/
2009-07-23 01:32:45 +00:00
2015-08-03 13:32:46 +00:00
$flash = $page->get_cookie("flash_message");
$flash_html = "";
if($flash) {
$flash_html = "<b id='flash'>".nl2br(html_escape($flash))." <a href='#' onclick=\"\$('#flash').hide(); return false;\">[X]</a></b>";
}
2009-07-23 01:32:45 +00:00
print <<<EOD
2012-03-05 10:14:58 +00:00
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
2009-07-23 01:32:45 +00:00
<head>
<title>{$page->title}</title>
$header_html
</head>
<body>
2012-03-11 16:18:37 +00:00
<header>
<table id="header" class="bgtop" width="100%" height="113px">
<tr>
<td><center>
<h1><a href="$data_href/$main_page">{$site_name}</a></h1>
<p>[Navigation links go here]
</center></td>
$head_block_html
</tr>
</table>
$sub_block_html
</header>
<nav>
$left_block_html
</nav>
<article>
$flash_html
2012-03-11 16:18:37 +00:00
$main_block_html
</article>
<footer>
2009-07-23 01:32:45 +00:00
Images &copy; their respective owners,
2010-01-03 09:41:31 +00:00
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> &copy;
<a href="http://www.shishnet.org/">Shish</a> &amp;
2014-02-25 17:40:07 +00:00
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
2016-05-22 15:13:38 +00:00
2007-2016,
2009-07-23 01:32:45 +00:00
based on the Danbooru concept.
$debug
$contact
2012-03-11 16:18:37 +00:00
</footer>
2009-07-23 01:32:45 +00:00
</body>
</html>
EOD;
}
}