From cdfd67c87a6177101f920acbdd33b94d00a13fda Mon Sep 17 00:00:00 2001 From: Michael Save Date: Tue, 14 Feb 2012 21:02:06 +1100 Subject: frameset theme: transition to twig, plus more configurable --- templates/themes/frameset/theme.php | 98 ++++++------------------------------- 1 file changed, 15 insertions(+), 83 deletions(-) (limited to 'templates/themes/frameset/theme.php') diff --git a/templates/themes/frameset/theme.php b/templates/themes/frameset/theme.php index 7eac4b99..08db7d1d 100644 --- a/templates/themes/frameset/theme.php +++ b/templates/themes/frameset/theme.php @@ -16,13 +16,13 @@ global $config; if($action == 'all') - file_write($config['dir']['home'] . $config['file_index'], Frameset::homepage($settings)); + file_write($config['dir']['home'] . $settings['file_main'], Frameset::homepage($settings)); if($action == 'all' || $action == 'boards') - file_write($config['dir']['home'] . 'sidebar.html', Frameset::sidebar($settings)); + file_write($config['dir']['home'] . $settings['file_sidebar'], Frameset::sidebar($settings)); if($action == 'all' || $action == 'news') - file_write($config['dir']['home'] . 'news.html', Frameset::news($settings)); + file_write($config['dir']['home'] . $settings['file_news'], Frameset::news($settings)); } // Build homepage @@ -30,61 +30,21 @@ global $config; // HTML5 - return '' - . '' - . '' - . '' - . '' . $settings['title'] . '' - . '' - // Sidebar - . '' - // Main - . '' - // Finish page - . ''; + return Element('themes/frameset/frames.html', Array('config' => $config, 'settings' => $settings)); } // 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 ' . - strftime($config['post_date'], $news['time']) . - '

' . $news['body'] . '

'; - } - } + $news = $query->fetchAll(PDO::FETCH_ASSOC); - // Finish page - $body .= ''; + return Element('themes/frameset/news.html', Array( + 'settings' => $settings, + 'config' => $config, + 'news' => $news + )); return $body; } @@ -93,39 +53,11 @@ public static function sidebar($settings) { global $config, $board; - $body = '' - . '' - . '' - . '' - . '' - . '' . $settings['title'] . '' - . ''; - - $body .= '
' . $settings['title'] . '
'; - - - $body .= '
Boards
'; - - // Finish page - $body .= ''; + return Element('themes/frameset/sidebar.html', Array( + 'settings' => $settings, + 'config' => $config, + 'boards' => listBoards() + )); return $body; } -- cgit v1.3