/
tag.php
executable file
·59 lines (42 loc) · 1.96 KB
/
tag.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
51
52
53
54
55
56
57
58
59
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Tag extends S {
private $_prepage = 20;
public function __construct() {
parent::__construct();
}
public function index($start = 0) {
$this->load->library('pagination');
$config['base_url'] = site_url('tag');
$config['total_rows'] = $this->tag_model->get_rows();
$config['per_page'] = $this->_prepage;
$config['num_links'] = 5;
$config['uri_segment'] = 2;
$config['suffix'] = config_item('url_suffix');
$this->pagination->initialize($config);
$data['pres'] = $this->_prepage;
$data['rows'] = $config['total_rows'];
$data['page'] = $this->pagination->create_links();
$data['list'] = $this->tag_model->get_list($start, $config['per_page']);
$this->load->view('site_tag_list', $data);
}
public function name($name = '', $start = 0) {
$tag = $this->tag_model->get_info(array('slug'=>$name));
if( ! $tag ) show_404();
$this->load->library('pagination');
$config['base_url'] = site_url('tag/' . $name);
$config['total_rows'] = $this->article_model->tag_rows($tag->tid);
$config['per_page'] = $this->_prepage;
$config['num_links'] = 5;
$config['uri_segment'] = 3;
$config['suffix'] = config_item('url_suffix');
$this->pagination->initialize($config);
$data['pres'] = $this->_prepage;
$data['rows'] = $config['total_rows'];
$data['page'] = $this->pagination->create_links();
$data['list'] = $this->article_model->tag_list($tag->tid, $start, $config['per_page']);
$data['tag'] = $tag;
$this->load->view('site_tag', $data);
}
}
/* End of file tag.php */
/* Location: ./application/controllers/tag.php */