From cbb1dc4be9cbf86afc778473807202a653d6586c Mon Sep 17 00:00:00 2001 From: shish Date: Sat, 28 Jul 2007 20:47:54 +0000 Subject: [PATCH] themable home page git-svn-id: file:///home/shish/svn/shimmie2/trunk@396 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/home/main.php | 53 +++++----------------------------------- contrib/home/theme.php | 55 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 47 deletions(-) create mode 100644 contrib/home/theme.php diff --git a/contrib/home/main.php b/contrib/home/main.php index 77686219..4153e5cf 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -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('[', "", $main_links); $main_links = str_replace(']', "", $main_links); - - return " -
-

- $sitename -

- -
-
-
- -
-
-
- contact – Serving $num_comma posts -
- -
- Powered by Shimmie -
-
- $counter_text -
-
"; + + 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(<< - - $sitename - - - - - $body - - -EOD -); + $this->theme->display_page($page, $sitename, $data_href, $theme_name, $body); } } diff --git a/contrib/home/theme.php b/contrib/home/theme.php new file mode 100644 index 00000000..fbad17ff --- /dev/null +++ b/contrib/home/theme.php @@ -0,0 +1,55 @@ +set_mode("data"); + $page->set_data(<< + + $sitename + + + + + $body + + +EOD +); + } + + public function build_body($sitename, $main_links, $contact_link, $num_comma, $counter_text) { + return " +
+

+ $sitename +

+ +
+
+
+ +
+
+
+ contact – Serving $num_comma posts +
+ +
+ Powered by Shimmie +
+
+ $counter_text +
+
"; + } +} +?>