php Helly Blog -------------------- -------------- Author Fesor Email

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?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);
}
}