mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 01:10:51 +01:00
use Twig template for "basic" theme
This commit is contained in:
parent
3868004169
commit
658a7b4379
35
templates/themes/basic/index.html
Normal file
35
templates/themes/basic/index.html
Normal file
@ -0,0 +1,35 @@
|
||||
{% filter remove_whitespace %}
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ settings.title }}</title>
|
||||
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}"/>
|
||||
</head>
|
||||
<body>
|
||||
{{ boardlist.top }}
|
||||
<h1>{{ settings.title }}</h1>
|
||||
<div class="title">{{ settings.subtitle }}</div>
|
||||
|
||||
<div class="ban">
|
||||
{% if news|count == 0 %}
|
||||
<p style="text-align:center" class="unimportant">(No news to show.)</p>
|
||||
{% else %}
|
||||
{% for entry in news %}
|
||||
<h2 id="{{ entry.id }}">
|
||||
{% if entry.subject %}
|
||||
{{ entry.subject }}
|
||||
{% else %}
|
||||
<em>no subject</em>
|
||||
{% endif %}
|
||||
<span class="unimportant"> — by {{ entry.name }} at {{ entry.time|date(config.post_date) }}</span>
|
||||
</h2>
|
||||
<p>{{ entry.body }}</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> {{ config.version }} | <a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2012 Tinyboard Development Group</p>
|
||||
</body>
|
||||
</html>
|
||||
{% endfilter %}
|
@ -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';
|
||||
?>
|
||||
?>
|
||||
|
@ -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"> — by ' .
|
||||
$news['name'] .
|
||||
' at ' .
|
||||
strftime($config['post_date'], $news['time']) .
|
||||
'</span></h2><p>' . $news['body'] . '</p>';
|
||||
}
|
||||
}
|
||||
$news = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$body .= '</div>';
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user