34 lines
717 B
PHP
34 lines
717 B
PHP
<?php
|
|
|
|
class Blog_IndexController extends Fiktiv_Controller_Action
|
|
{
|
|
public function indexAction()
|
|
{
|
|
$this->_forward('latest');
|
|
}
|
|
|
|
public function latestAction()
|
|
{
|
|
// Fetch last ten posts
|
|
$posts = new ModelBlogPost();
|
|
$this->view->posts = $posts->fetchAll(null, 'pubDate DESC', 10);
|
|
}
|
|
|
|
public function readableAction()
|
|
{
|
|
}
|
|
|
|
public function readAction()
|
|
{
|
|
$posts = new ModelBlogPost();
|
|
|
|
$plink = $this->_getParam('permlink');
|
|
$post = $posts->findByPermlink($plink);
|
|
|
|
if (!$post) {
|
|
$this->_redirect(array('action' => 'latest'));
|
|
}
|
|
|
|
$this->view->post = $post;
|
|
}
|
|
}
|