SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | defined('BASEPATH') OR exit('No direct script access allowed'); | |
3 | ||
4 | ||
5 | ||
6 | class Read extends CI_Controller { | |
7 | ||
8 | /** | |
9 | * Index Page for this controller. | |
10 | * | |
11 | * Maps to the following URL | |
12 | * http://example.com/index.php/welcome | |
13 | * - or - | |
14 | * http://example.com/index.php/welcome/index | |
15 | * - or - | |
16 | * Since this controller is set as the default controller in | |
17 | * config/routes.php, it's displayed at http://example.com/ | |
18 | * | |
19 | * So any other public methods not prefixed with an underscore will | |
20 | * map to /index.php/welcome/<method_name> | |
21 | * @see https://codeigniter.com/user_guide/general/urls.html | |
22 | */ | |
23 | public function __construct() { | |
24 | parent::__construct(); | |
25 | $this->load->model('data', 'read'); | |
26 | $this->load->library('session'); | |
27 | $this->load->helper('form'); | |
28 | $this->load->helper('url'); | |
29 | $this->load->helper('html'); | |
30 | ||
31 | $this->load->library('form_validation'); | |
32 | } | |
33 | ||
34 | public function index() | |
35 | { | |
36 | ||
37 | ||
38 | #Construct | |
39 | $content_details = array(); | |
40 | $t = array(); | |
41 | $channel_main = $this->config->item("channel_main_id"); | |
42 | ||
43 | $t['title'] = 'News Portal Kids Now'; | |
44 | $data['read'] = $t['title'] ; | |
45 | $t['read'] = $this->read->all(); | |
46 | ||
47 | ||
48 | ||
49 | $a['v_detail'] = $this->load->view('read/v_detail', $t, true); | |
50 | //$t['select_data'] = $this->read->get(); | |
51 | ||
52 | ||
53 | ||
54 | //$t['breaking'] = $this->tommy->all(); | |
55 | //var_dump($t['isi'] ); | |
56 | ||
57 | //$this->benchmark->mark('end_view'); | |
58 | $this->load->view("read/v_detail", $t); | |
59 | //$page = $this->load->view("read/v_detail", $t); | |
60 | // return $page; | |
61 | ||
62 | //$result = $this->tommy->proses_tampil($id); | |
63 | //return $pages; | |
64 | } | |
65 | ||
66 | ||
67 | ||
68 | ||
69 | ||
70 | ||
71 | public function detail($idartikel) { | |
72 | $this->load->model('data', 'detail'); | |
73 | $this->load->library('form_validation'); | |
74 | //$t['judul'] = $judul->judul . ' | News Portal'; | |
75 | //$this->db->get_where($this->read, array('judul' => $judul[1])); | |
76 | //$t['title'] = $post->title . ' | News Portal'; | |
77 | ||
78 | //$t['title'] = $this->detail->all(); | |
79 | //$data['detail'] = $t['title'] ; | |
80 | ||
81 | $t['read'] = $this->detail->all(10); | |
82 | //$t['detail'] = $this->detail->anjing($idartikel); | |
83 | $t['populer'] = $this->detail->populer(); | |
84 | ||
85 | $t['opini'] = $this->detail->all_opini(1); | |
86 | //$t['read'] = $this->detail->populer(3); | |
87 | ||
88 | //$t['nasional'] = $this->detail->all_nasional(); | |
89 | //$t['ekonomi'] = $this->detail->all_ekonomi(); | |
90 | //$t['internasional'] = $this->detail->all_internasional(); | |
91 | //$t['olahraga'] = $this->detail->all_olahraga(); | |
92 | //$t['humaniora'] = $this->detail->all_humaniora(); | |
93 | //$t['muda'] = $this->detail->all_muda(); | |
94 | //$t['video'] = $this->detail->videos(); | |
95 | //$id = $this->uri->segment(3); | |
96 | //$t['berita'] = $this->data->get_detail($id); | |
97 | //$t['tags'] = $this->read->all_hastag(); | |
98 | $t['detail'] = $this->detail->get($idartikel); | |
99 | - | $t['title'] = $t['detail'][0]['title']; |
99 | + | $query_detail = $this->db->last_query(); |
100 | ||
101 | ||
102 | //echo $this->db->last_query(); die('<br/>biar bisa lihat apa query terakhir yg dijalankan. hapus aja line yg tidak perlu ini'); | |
103 | ||
104 | ||
105 | - | echo "<pre>"; |
105 | + | |
106 | - | print_r($t['detail']); |
106 | + | $t['title'] = isset($t['detail'][0]['title'])?$t['detail'][0]['title']:''; |
107 | - | echo "</pre>"; |
107 | + | |
108 | ||
109 | - | $this->load->view( |
109 | + | |
110 | $t['category'] = $this->detail->kategori($idartikel); | |
111 | //$t['category'] = $this->detail->kategori(); | |
112 | ||
113 | if(!$t['detail']) { | |
114 | echo "PERHATIAN.. jalankan query dibawah ini di phpmyadmin:<pre><br>{$query_detail}<hr/>"; | |
115 | var_dump($t['detail']); | |
116 | die('<hr> '); | |
117 | /* | |
118 | $this->load->view( | |
119 | 'Could not load the requested item', | |
120 | 'warning' | |
121 | ); | |
122 | */ | |
123 | redirect('read'); | |
124 | return; | |
125 | } | |
126 | //$t['read'] = $this->read->select_data(); | |
127 | ||
128 | //$t['title'] = $t->title . ' | MI'; | |
129 | - | } |
129 | + | |
130 | //$t['penulis'] = penulis($t['penulis']->nip); | |
131 | ||
132 | $this->load->view("read/v_detail", $t); | |
133 | ||
134 | - | ------------------------------------------------ end controller -------------------------------------------------------------------------- |
134 | + | |
135 | ||
136 | ||
137 | ||
138 | ||
139 | } |