lainchan/templates/themes/basic/theme.php

41 lines
1.0 KiB
PHP
Raw Normal View History

2011-04-13 14:33:18 -04:00
<?php
2011-04-14 08:12:56 -04:00
require 'info.php';
2011-04-13 14:33:18 -04:00
2011-04-14 08:12:56 -04:00
function basic_build($action, $settings) {
// Possible values for $action:
// - all (rebuild everything, initialization)
// - news (news has been updated)
// - boards (board list changed)
Basic::build($action, $settings);
2011-04-13 14:33:18 -04:00
}
2011-04-14 08:12:56 -04:00
2011-04-13 14:33:18 -04:00
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Basic {
2011-04-14 06:43:34 -04:00
public static function build($action, $settings) {
2011-04-13 14:33:18 -04:00
global $config;
2011-04-14 06:43:34 -04:00
if($action == 'all' || $action == 'news')
file_write($config['dir']['home'] . $config['file_index'], Basic::homepage($settings));
2011-04-13 14:33:18 -04:00
}
// Build news page
public static function homepage($settings) {
global $config;
$query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error());
2012-02-07 17:08:13 -05:00
$news = $query->fetchAll(PDO::FETCH_ASSOC);
return Element('themes/basic/index.html', Array(
'settings' => $settings,
'config' => $config,
'boardlist' => createBoardlist(),
'news' => $news
));
2011-04-13 14:33:18 -04:00
return $body;
}
};
2011-10-06 08:26:07 -04:00
?>