summaryrefslogtreecommitdiff
path: root/templates/themes/basic/theme.php
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-02-08 09:08:13 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-02-08 09:08:13 +1100
commit658a7b43791921a06132ad5db8beacb33a6ef5dc (patch)
treef4665b881f1985aac29493c683148ed20bd7b081 /templates/themes/basic/theme.php
parent3868004169decf757dfa3f29c8624e5c6e8e5715 (diff)
use Twig template for "basic" theme
Diffstat (limited to 'templates/themes/basic/theme.php')
-rw-r--r--templates/themes/basic/theme.php44
1 files changed, 7 insertions, 37 deletions
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 = '<!DOCTYPE html><html>'
- . '<head>'
- . '<link rel="stylesheet" media="screen" href="' . $config['url_stylesheet'] . '"/>'
- . '<title>' . $settings['title'] . '</title>'
- . '</head><body>';
-
- $boardlist = createBoardlist();
- $body .= '<div class="boardlist">' . $boardlist['top'] . '</div>';
-
- $body .= '<h1>' . $settings['title'] . '</h1>'
- . '<div class="title">' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '</div>';
-
- $body .= '<div class="ban">';
-
$query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error());
- if($query->rowCount() == 0) {
- $body .= '<p style="text-align:center" class="unimportant">(No news to show.)</p>';
- } else {
- // List news
- while($news = $query->fetch()) {
- $body .= '<h2 id="' . $news['id'] . '">' .
- ($news['subject'] ?
- $news['subject']
- :
- '<em>no subject</em>'
- ) .
- '<span class="unimportant"> &mdash; by ' .
- $news['name'] .
- ' at ' .
- strftime($config['post_date'], $news['time']) .
- '</span></h2><p>' . $news['body'] . '</p>';
- }
- }
-
- $body .= '</div>';
+ $news = $query->fetchAll(PDO::FETCH_ASSOC);
- // Finish page
- $body .= '<hr/><p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a></body></html>';
+ return Element('themes/basic/index.html', Array(
+ 'settings' => $settings,
+ 'config' => $config,
+ 'boardlist' => createBoardlist(),
+ 'news' => $news
+ ));
return $body;
}