"# of recent entries" setting adding to basic theme

This commit is contained in:
Michael Save 2012-02-08 19:20:08 +11:00
parent 658a7b4379
commit 5c847c75ac
2 changed files with 33 additions and 5 deletions

View file

@ -16,14 +16,16 @@
global $config;
if($action == 'all' || $action == 'news')
file_write($config['dir']['home'] . $config['file_index'], Basic::homepage($settings));
file_write($config['dir']['home'] . $settings['file'], Basic::homepage($settings));
}
// Build news page
public static function homepage($settings) {
global $config;
$query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error());
$settings['no_recent'] = (int) $settings['no_recent'];
$query = query("SELECT * FROM `news` ORDER BY `time` DESC" . ($settings['no_recent'] ? ' LIMIT ' . $settings['no_recent'] : '')) or error(db_error());
$news = $query->fetchAll(PDO::FETCH_ASSOC);
return Element('themes/basic/index.html', Array(