themable home page
git-svn-id: file:///home/shish/svn/shimmie2/trunk@396 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
0b7c038f52
commit
cbb1dc4be9
@ -10,9 +10,11 @@
|
||||
*/
|
||||
|
||||
class Home extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
global $page;
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("home", "HomeTheme");
|
||||
|
||||
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "home"))
|
||||
{
|
||||
// this is a request to display this page so output the page.
|
||||
@ -64,32 +66,8 @@ class Home extends Extension {
|
||||
$main_links = str_replace('[', "<a href='", $main_links);
|
||||
$main_links = str_replace('|', "'>", $main_links);
|
||||
$main_links = str_replace(']', "</a>", $main_links);
|
||||
|
||||
return "
|
||||
<div id='front-page'>
|
||||
<h1>
|
||||
<a style='text-decoration: none;' href='".make_link()."'><span>$sitename</span></a>
|
||||
</h1>
|
||||
<div class='space' id='links'>
|
||||
$main_links
|
||||
</div>
|
||||
<div class='space'>
|
||||
<form action='".make_link("post/list")."' method='GET'>
|
||||
<input id='search_input' name='search' size='55' type='text' value='' autocomplete='off' /><br/>
|
||||
<input type='submit' value='Search'/>
|
||||
</form>
|
||||
</div>
|
||||
<div style='font-size: 80%; margin-bottom: 2em;'>
|
||||
<a href='$contact_link'>contact</a> – Serving $num_comma posts
|
||||
</div>
|
||||
|
||||
<div class='space'>
|
||||
Powered by <a href='http://trac.shishnet.org/shimmie2/'>Shimmie</a>
|
||||
</div>
|
||||
<div class='space'>
|
||||
$counter_text
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
return $this->theme->build_body($sitename, $main_links, $contact_link, $num_comma, $counter_text);
|
||||
}
|
||||
|
||||
private function output_pages($page)
|
||||
@ -103,26 +81,7 @@ class Home extends Extension {
|
||||
|
||||
$body = $this->get_body();
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_data(<<<EOD
|
||||
<html>
|
||||
<head>
|
||||
<title>$sitename</title>
|
||||
<link rel='stylesheet' href='$data_href/themes/$theme_name/style.css' type='text/css'>
|
||||
</head>
|
||||
<style>
|
||||
div#front-page h1 {font-size: 4em; margin-top: 2em; text-align: center; border: none; background: none;}
|
||||
div#front-page {text-align:center;}
|
||||
.space {margin-bottom: 1em;}
|
||||
div#front-page div#links a {margin: 0 0.5em;}
|
||||
div#front-page li {list-style-type: none; margin: 0;}
|
||||
</style>
|
||||
<body>
|
||||
$body
|
||||
</body>
|
||||
</html>
|
||||
EOD
|
||||
);
|
||||
$this->theme->display_page($page, $sitename, $data_href, $theme_name, $body);
|
||||
}
|
||||
|
||||
}
|
||||
|
55
contrib/home/theme.php
Normal file
55
contrib/home/theme.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
class HomeTheme extends Themelet {
|
||||
public function display_page($page, $sitename, $data_href, $theme_name, $body) {
|
||||
$page->set_mode("data");
|
||||
$page->set_data(<<<EOD
|
||||
<html>
|
||||
<head>
|
||||
<title>$sitename</title>
|
||||
<link rel='stylesheet' href='$data_href/themes/$theme_name/style.css' type='text/css'>
|
||||
</head>
|
||||
<style>
|
||||
div#front-page h1 {font-size: 4em; margin-top: 2em; text-align: center; border: none; background: none;}
|
||||
div#front-page {text-align:center;}
|
||||
.space {margin-bottom: 1em;}
|
||||
div#front-page div#links a {margin: 0 0.5em;}
|
||||
div#front-page li {list-style-type: none; margin: 0;}
|
||||
</style>
|
||||
<body>
|
||||
$body
|
||||
</body>
|
||||
</html>
|
||||
EOD
|
||||
);
|
||||
}
|
||||
|
||||
public function build_body($sitename, $main_links, $contact_link, $num_comma, $counter_text) {
|
||||
return "
|
||||
<div id='front-page'>
|
||||
<h1>
|
||||
<a style='text-decoration: none;' href='".make_link()."'><span>$sitename</span></a>
|
||||
</h1>
|
||||
<div class='space' id='links'>
|
||||
$main_links
|
||||
</div>
|
||||
<div class='space'>
|
||||
<form action='".make_link("post/list")."' method='GET'>
|
||||
<input id='search_input' name='search' size='55' type='text' value='' autocomplete='off' /><br/>
|
||||
<input type='submit' value='Search'/>
|
||||
</form>
|
||||
</div>
|
||||
<div style='font-size: 80%; margin-bottom: 2em;'>
|
||||
<a href='$contact_link'>contact</a> – Serving $num_comma posts
|
||||
</div>
|
||||
|
||||
<div class='space'>
|
||||
Powered by <a href='http://trac.shishnet.org/shimmie2/'>Shimmie</a>
|
||||
</div>
|
||||
<div class='space'>
|
||||
$counter_text
|
||||
</div>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user