mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-29 09:44:28 +01:00
"basic" theme
This commit is contained in:
parent
0d41ac46c6
commit
22ae88290a
88
templates/homepage/basic/theme.php
Normal file
88
templates/homepage/basic/theme.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
$theme = Array();
|
||||
|
||||
// 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 configuration
|
||||
$theme['config'] = Array();
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Title',
|
||||
'name' => 'title',
|
||||
'type' => 'text'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Slogan',
|
||||
'name' => 'subtitle',
|
||||
'type' => 'text'
|
||||
);
|
||||
|
||||
// Unique function name for building everything
|
||||
$config['build_function'] = 'basic_build';
|
||||
|
||||
function basic_build($settings) {
|
||||
Basic::build($settings);
|
||||
}
|
||||
|
||||
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
||||
class Basic {
|
||||
public static function build($settings) {
|
||||
global $config;
|
||||
|
||||
file_put_contents($config['dir']['home'] . $config['file_index'], Basic::homepage($settings));
|
||||
}
|
||||
|
||||
// Build news page
|
||||
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 ' .
|
||||
date($config['post_date'], $news['time']) .
|
||||
'</span></h2><p>' . $news['body'] . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
$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 $body;
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
BIN
templates/homepage/basic/thumb.png
Normal file
BIN
templates/homepage/basic/thumb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
Loading…
Reference in New Issue
Block a user