2007-06-30 01:19:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Layout {
|
2009-05-11 14:04:33 +00:00
|
|
|
function display_page($page) {
|
|
|
|
global $config;
|
2009-01-20 11:17:49 +00:00
|
|
|
|
2007-07-16 14:09:12 +00:00
|
|
|
$theme_name = $config->get_string('theme', 'default');
|
2007-07-16 21:30:28 +00:00
|
|
|
$data_href = get_base_href();
|
2007-06-30 01:19:11 +00:00
|
|
|
$contact_link = $config->get_string('contact_link');
|
|
|
|
|
|
|
|
$header_html = "";
|
2011-08-28 04:31:30 +00:00
|
|
|
ksort($page->html_headers);
|
|
|
|
foreach($page->html_headers as $line) {
|
2007-06-30 01:19:11 +00:00
|
|
|
$header_html .= "\t\t$line\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$left_block_html = "";
|
|
|
|
$main_block_html = "";
|
2010-01-03 09:56:07 +00:00
|
|
|
$sub_block_html = "";
|
2007-06-30 01:19:11 +00:00
|
|
|
|
|
|
|
foreach($page->blocks as $block) {
|
|
|
|
switch($block->section) {
|
|
|
|
case "left":
|
2007-12-30 12:03:05 +00:00
|
|
|
$left_block_html .= $this->block_to_html($block, true, "left");
|
2007-06-30 01:19:11 +00:00
|
|
|
break;
|
|
|
|
case "main":
|
2007-12-30 12:03:05 +00:00
|
|
|
$main_block_html .= $this->block_to_html($block, false, "main");
|
2007-06-30 01:19:11 +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;
|
2007-06-30 01:19:11 +00:00
|
|
|
default:
|
|
|
|
print "<p>error: {$block->header} using an unknown section ({$block->section})";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$debug = get_debug_info();
|
|
|
|
|
2011-12-28 14:47:02 +00:00
|
|
|
$contact = empty($contact_link) ? "" : "<br><a href='mailto:$contact_link'>Contact</a>";
|
2008-12-16 05:19:44 +00:00
|
|
|
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
2007-06-30 01:19:11 +00:00
|
|
|
|
2009-01-24 10:25:50 +00:00
|
|
|
$wrapper = "";
|
|
|
|
if(strlen($page->heading) > 100) {
|
|
|
|
$wrapper = ' style="height: 3em; overflow: auto;"';
|
|
|
|
}
|
|
|
|
|
2007-06-30 01:19:11 +00:00
|
|
|
print <<<EOD
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>{$page->title}</title>
|
2007-07-06 05:57:24 +00:00
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
2007-06-30 01:19:11 +00:00
|
|
|
<link rel="stylesheet" href="$data_href/themes/$theme_name/style.css" type="text/css">
|
|
|
|
$header_html
|
|
|
|
<script src='$data_href/themes/$theme_name/sidebar.js' type='text/javascript'></script>
|
2008-04-11 05:40:20 +00:00
|
|
|
<script src='$data_href/themes/$theme_name/script.js' type='text/javascript'></script>
|
2007-06-30 01:19:11 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2009-01-24 10:25:50 +00:00
|
|
|
<h1$wrapper>{$page->heading}</h1>
|
2007-06-30 01:19:11 +00:00
|
|
|
$subheading
|
2010-01-03 09:56:07 +00:00
|
|
|
$sub_block_html
|
2007-06-30 01:19:11 +00:00
|
|
|
|
|
|
|
<div id="nav">$left_block_html</div>
|
|
|
|
<div id="body">$main_block_html</div>
|
|
|
|
|
|
|
|
<div id="footer">
|
|
|
|
<hr>
|
|
|
|
Images © their respective owners,
|
2010-01-03 09:41:31 +00:00
|
|
|
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
2011-01-01 15:58:44 +00:00
|
|
|
<a href="http://www.shishnet.org/">Shish</a> & Co 2007-2011,
|
2009-06-05 16:55:58 +00:00
|
|
|
based on the Danbooru concept.
|
2007-06-30 01:19:11 +00:00
|
|
|
$debug
|
|
|
|
$contact
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOD;
|
|
|
|
}
|
|
|
|
|
2007-12-30 12:03:05 +00:00
|
|
|
function block_to_html($block, $hidable=false, $salt="") {
|
2007-06-30 01:19:11 +00:00
|
|
|
$h = $block->header;
|
|
|
|
$b = $block->body;
|
|
|
|
$html = "";
|
2007-12-30 12:03:05 +00:00
|
|
|
$i = str_replace(' ', '_', $h) . $salt;
|
2007-06-30 01:19:11 +00:00
|
|
|
if($hidable) {
|
2007-07-16 06:43:49 +00:00
|
|
|
$toggle = " onclick=\"toggle('$i')\"";
|
2007-06-30 01:19:11 +00:00
|
|
|
}
|
|
|
|
else {
|
2007-07-16 06:43:49 +00:00
|
|
|
$toggle = "";
|
2007-06-30 01:19:11 +00:00
|
|
|
}
|
2007-07-16 06:43:49 +00:00
|
|
|
if(!is_null($h)) $html .= "\n<h3 id='$i-toggle'$toggle>$h</h3>\n";
|
|
|
|
if(!is_null($b)) $html .= "<div id='$i'>$b</div>\n";
|
2007-06-30 01:19:11 +00:00
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|