From 658a7b43791921a06132ad5db8beacb33a6ef5dc Mon Sep 17 00:00:00 2001 From: Michael Save Date: Wed, 8 Feb 2012 09:08:13 +1100 Subject: [PATCH] use Twig template for "basic" theme --- templates/themes/basic/index.html | 35 +++++++++++++++++++++++++++++++ templates/themes/basic/info.php | 6 +++--- templates/themes/basic/theme.php | 44 +++++++-------------------------------- 3 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 templates/themes/basic/index.html diff --git a/templates/themes/basic/index.html b/templates/themes/basic/index.html new file mode 100644 index 00000000..f0dc0304 --- /dev/null +++ b/templates/themes/basic/index.html @@ -0,0 +1,35 @@ +{% filter remove_whitespace %} + + + + {{ settings.title }} + + + + {{ boardlist.top }} +

{{ settings.title }}

+
{{ settings.subtitle }}
+ +
+ {% if news|count == 0 %} +

(No news to show.)

+ {% else %} + {% for entry in news %} +

+ {% if entry.subject %} + {{ entry.subject }} + {% else %} + no subject + {% endif %} + — by {{ entry.name }} at {{ entry.time|date(config.post_date) }} +

+

{{ entry.body }}

+ {% endfor %} + {% endif %} +
+ +
+

Powered by Tinyboard {{ config.version }} | Tinyboard Copyright © 2010-2012 Tinyboard Development Group

+ + +{% endfilter %} diff --git a/templates/themes/basic/info.php b/templates/themes/basic/info.php index bd856655..0c5f0323 100644 --- a/templates/themes/basic/info.php +++ b/templates/themes/basic/info.php @@ -4,8 +4,8 @@ // Theme name $theme['name'] = 'Basic'; // Description (you can use Tinyboard markup here) - $theme['description'] = 'Extremely basic news listing for the homepage. It\'s suggested that you enable boardlinks for this theme.'; - $theme['version'] = 'v0.9'; + $theme['description'] = 'Extremely basic news listing for the homepage. Enabling boardlinks is recommended for this theme.'; + $theme['version'] = 'v0.9.1'; // Theme configuration $theme['config'] = Array(); @@ -24,4 +24,4 @@ // Unique function name for building everything $theme['build_function'] = 'basic_build'; -?> \ No newline at end of file +?> diff --git a/templates/themes/basic/theme.php b/templates/themes/basic/theme.php index 2513754a..8dba89cc 100644 --- a/templates/themes/basic/theme.php +++ b/templates/themes/basic/theme.php @@ -23,45 +23,15 @@ public static function homepage($settings) { global $config; - // HTML5 - $body = '' - . '' - . '' - . '' . $settings['title'] . '' - . ''; - - $boardlist = createBoardlist(); - $body .= '
' . $boardlist['top'] . '
'; - - $body .= '

' . $settings['title'] . '

' - . '
' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '
'; - - $body .= '
'; - $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); - $body .= '
'; - - // Finish page - $body .= '

Powered by Tinyboard'; + return Element('themes/basic/index.html', Array( + 'settings' => $settings, + 'config' => $config, + 'boardlist' => createBoardlist(), + 'news' => $news + )); return $body; }