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;
|
|
|
|
|
2014-04-24 08:44:28 +00:00
|
|
|
//$theme_name = $config->get_string('theme', 'default');
|
2011-12-25 09:47:34 +00:00
|
|
|
$site_name = $config->get_string('title');
|
2009-07-23 01:32:45 +00:00
|
|
|
$data_href = get_base_href();
|
2011-12-25 09:47:34 +00:00
|
|
|
$main_page = $config->get_string('main_page');
|
2016-06-06 11:12:25 +00:00
|
|
|
$contact_link = contact_link();
|
2016-06-18 11:25:54 +00:00
|
|
|
$header_html = $page->get_all_html_headers();
|
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();
|
|
|
|
|
2016-06-06 11:12:25 +00:00
|
|
|
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
2014-04-24 08:44:28 +00:00
|
|
|
/*$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;"';
|
|
|
|
}
|
2014-04-24 08:44:28 +00:00
|
|
|
*/
|
2009-07-23 01:32:45 +00:00
|
|
|
|
2015-08-03 13:32:46 +00:00
|
|
|
$flash = $page->get_cookie("flash_message");
|
2012-06-09 16:00:25 +00:00
|
|
|
$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>
|
2012-06-09 16:00:25 +00:00
|
|
|
$flash_html
|
2012-03-11 16:18:37 +00:00
|
|
|
$main_block_html
|
|
|
|
</article>
|
|
|
|
<footer>
|
2009-07-23 01:32:45 +00:00
|
|
|
Images © their respective owners,
|
2010-01-03 09:41:31 +00:00
|
|
|
<a href="http://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
2012-02-06 05:34:06 +00:00
|
|
|
<a href="http://www.shishnet.org/">Shish</a> &
|
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;
|
|
|
|
}
|
|
|
|
}
|
2014-04-24 23:13:20 +00:00
|
|
|
|