From d17e756881e009031519ae7e62361cefe0442daf Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 14 Apr 2011 00:24:49 +1000 Subject: news --- templates/homepage/frameset/theme.php | 53 +++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) (limited to 'templates/homepage/frameset/theme.php') diff --git a/templates/homepage/frameset/theme.php b/templates/homepage/frameset/theme.php index 3964a469..5942f3c2 100644 --- a/templates/homepage/frameset/theme.php +++ b/templates/homepage/frameset/theme.php @@ -12,12 +12,19 @@ Users never have to leave the homepage; they can do all their browsing from the // Theme configuration $theme['config'] = Array(); + $theme['config'][] = Array( - 'title' => 'Page title', + 'title' => 'Title', 'name' => 'title', 'type' => 'text' ); + $theme['config'][] = Array( + 'title' => 'Slogan', + 'name' => 'subtitle', + 'type' => 'text' + ); + // Unique function name for building everything $config['build_function'] = 'frameset_build'; @@ -32,6 +39,7 @@ Users never have to leave the homepage; they can do all their browsing from the file_put_contents($config['dir']['home'] . $config['file_index'], Frameset::homepage($settings)); file_put_contents($config['dir']['home'] . 'sidebar.html', Frameset::sidebar($settings)); + file_put_contents($config['dir']['home'] . 'news.html', Frameset::news($settings)); } // Build homepage @@ -52,11 +60,52 @@ Users never have to leave the homepage; they can do all their browsing from the // Sidebar . '' // Main - . '' + . '' // Finish page . ''; } + // Build news page + public static function news($settings) { + global $config; + + // HTML5 + $body = '' + . '' + . '' + . 'News' + . ''; + + $body .= '

' . $settings['title'] . '

' + . '
' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '
'; + + $query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error()); + if($query->rowCount() == 0) { + $body .= '

(No news to show.)

'; + } else { + // List news + while($news = $query->fetch()) { + $body .= '
' . + '

' . + ($news['subject'] ? + $news['subject'] + : + 'no subject' + ) . + ' — by ' . + $news['name'] . + ' at ' . + date($config['post_date'], $news['time']) . + '

' . $news['body'] . '

'; + } + } + + // Finish page + $body .= ''; + + return $body; + } + // Build sidebar public static function sidebar($settings) { global $config, $board; -- cgit v1.3