Archived
1
0
Fork 0
This repository has been archived on 2026-05-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
fiktivkod/application/modules/blog/controllers/IndexController.php
2014-12-28 18:48:32 +01:00

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;
}
}