Source Code: blog/index.php
<?php
class index extends RLAction {
const SELECT_ARTICLES =
"SELECT
article_id, title, synopsis,
to_char(date_created, 'Mon FMDD YYYY') AS created
FROM
articles
WHERE
stat_active
ORDER BY
date_created DESC
LIMIT 5";
//-------------------------------------------------------------------------
public function __construct ($request) {
$request->attribs->set('pageTitle', 'A site dedicated to being dedicated to helping people learn stuff so they know things about computer programming and development and what not ™');
$request->attribs->set('homePage', true);
}
public function get ($request) {
$request->template = 'blog/index.tpl.php';
$db = new Database;
// Pull articles
$sql = $db->bind(self::SELECT_ARTICLES);
$db->query($sql);
$request->attribs->set('articles', $db->all());
}
}