/
Blog_widget.php
executable file
·50 lines (44 loc) · 1.63 KB
/
Blog_widget.php
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
*
* @author gofrendi
*/
class Blog_widget extends CMS_Controller {
public function __construct(){
parent::__construct();
$this->load->model($this->cms_module_path().'/article_model');
}
public function newest($how_many=5){
$data = array();
$data['articles'] = $this->article_model->get_articles(0, $how_many,
NULL, NULL);
$data['module_path'] = $this->cms_module_path();
$this->view($this->cms_module_path().'/widget_newest', $data);
}
public function popular($how_many=5){
$data = array();
$data['articles'] = $this->article_model->get_articles(0, $how_many,
NULL, NULL, NULL, FALSE, 'visited');
$data['module_path'] = $this->cms_module_path();
$this->view($this->cms_module_path().'/widget_popular', $data);
}
public function featured($how_many=5){
$data = array();
$data['articles'] = $this->article_model->get_articles(0, $how_many,
NULL, NULL, NULL, TRUE);
$data['module_path'] = $this->cms_module_path();
$this->view($this->cms_module_path().'/widget_featured', $data);
}
public function category(){
$data = array();
$data['categories'] = $this->article_model->get_available_category();
$data['module_path'] = $this->cms_module_path();
$this->view($this->cms_module_path().'/widget_category', $data);
}
public function archive(){
$data = array();
$data['archives'] = $this->article_model->get_archive();
$data['module_path'] = $this->cms_module_path();
$this->view($this->cms_module_path().'/widget_archive', $data);
}
}