Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Read extends CI_Controller {
- /**
- * Index Page for this controller.
- *
- * Maps to the following URL
- * http://example.com/index.php/welcome
- * - or -
- * http://example.com/index.php/welcome/index
- * - or -
- * Since this controller is set as the default controller in
- * config/routes.php, it's displayed at http://example.com/
- *
- * So any other public methods not prefixed with an underscore will
- * map to /index.php/welcome/<method_name>
- * @see https://codeigniter.com/user_guide/general/urls.html
- */
- public function __construct() {
- parent::__construct();
- $this->load->model('data', 'read');
- $this->load->library('session');
- $this->load->helper('form');
- $this->load->helper('url');
- $this->load->helper('html');
- $this->load->library('form_validation');
- }
- public function index()
- {
- #Construct
- $content_details = array();
- $t = array();
- $channel_main = $this->config->item("channel_main_id");
- $t['title'] = 'News Portal Kids Now';
- $data['read'] = $t['title'] ;
- $t['read'] = $this->read->all();
- $a['v_detail'] = $this->load->view('read/v_detail', $t, true);
- //$t['select_data'] = $this->read->get();
- //$t['breaking'] = $this->tommy->all();
- //var_dump($t['isi'] );
- //$this->benchmark->mark('end_view');
- $this->load->view("read/v_detail", $t);
- //$page = $this->load->view("read/v_detail", $t);
- // return $page;
- //$result = $this->tommy->proses_tampil($id);
- //return $pages;
- }
- public function detail($idartikel) {
- $this->load->model('data', 'detail');
- $this->load->library('form_validation');
- //$t['judul'] = $judul->judul . ' | News Portal';
- //$this->db->get_where($this->read, array('judul' => $judul[1]));
- //$t['title'] = $post->title . ' | News Portal';
- //$t['title'] = $this->detail->all();
- //$data['detail'] = $t['title'] ;
- $t['read'] = $this->detail->all(10);
- //$t['detail'] = $this->detail->anjing($idartikel);
- $t['populer'] = $this->detail->populer();
- $t['opini'] = $this->detail->all_opini(1);
- //$t['read'] = $this->detail->populer(3);
- //$t['nasional'] = $this->detail->all_nasional();
- //$t['ekonomi'] = $this->detail->all_ekonomi();
- //$t['internasional'] = $this->detail->all_internasional();
- //$t['olahraga'] = $this->detail->all_olahraga();
- //$t['humaniora'] = $this->detail->all_humaniora();
- //$t['muda'] = $this->detail->all_muda();
- //$t['video'] = $this->detail->videos();
- //$id = $this->uri->segment(3);
- //$t['berita'] = $this->data->get_detail($id);
- //$t['tags'] = $this->read->all_hastag();
- $t['detail'] = $this->detail->get($idartikel);
- $query_detail = $this->db->last_query();
- //echo $this->db->last_query(); die('<br/>biar bisa lihat apa query terakhir yg dijalankan. hapus aja line yg tidak perlu ini');
- $t['title'] = isset($t['detail'][0]['title'])?$t['detail'][0]['title']:'';
- //$t['related'] = $t['detail'][0]['title'];
- $t['category'] = $this->detail->kategori($idartikel);
- //$t['category'] = $this->detail->kategori();
- if(!$t['detail']) {
- echo "PERHATIAN.. jalankan query dibawah ini di phpmyadmin:<pre><br>{$query_detail}<hr/>";
- var_dump($t['detail']);
- die('<hr> ');
- /*
- $this->load->view(
- 'Could not load the requested item',
- 'warning'
- );
- */
- redirect('read');
- return;
- }
- //$t['read'] = $this->read->select_data();
- //$t['title'] = $t->title . ' | MI';
- // $t['data'] = $t;
- //$t['penulis'] = penulis($t['penulis']->nip);
- $this->load->view("read/v_detail", $t);
- }
- }
Add Comment
Please, Sign In to add comment