<?php
/*
==================================
Helly Blog
----------------------------------
@Author: Fesor
@Email: fesors@gmail.com
@Version: 1.0
@http://helly.fesor.ru/apps/blog
==================================
*/
class PostController extends CController
{
public function defaultAction()
{
return 'actionList';
}
//View list of posts
public function actionList()
{
$criterias = array(
'published' => true,
);
if(isset($_GET['category']))
$criterias['category'] = Blog::model()->getCategoryID($_GET['category']);
$posts = Post::model()->order("date DESC")->limit(system::app()->getParam('PerPage'))->count()->findAll($criterias);
view::Render('list', $posts);
}
}