Advertisement
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($slug) {
- $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['category'] = $this->detail->kategori();
- $t['opini'] = $this->detail->all_opini(1);
- //$t['read'] = $this->detail->populer(3);
- //$t['category'] = $this->detail->kategori($idartikel);
- //$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($slug);
- $t['title'] = $t['detail'][0]['title'];
- $t['title'] = $t['detail'][0]['title'];
- //$t['title'] = (isset($t['detail'][0]['title']) && $t['detail'][0]['title'] = "");
- //$t['image'] = (isset($t['detail'][0]['image']) && $t['detail'][0]['image'] = "");
- //echo '<pre>';
- //$data = json_decode($t['detail'][0]['image'],true) ;
- //print_r($data);
- //$t['image'] = $data['file'];
- //$file = json_decode($t['detail'][0]['image']);
- //$t['image'] = $file->file;
- $raw_image = json_decode(json_decode($t['detail'][0]['image'],true),TRUE);
- $t['image'] = $raw_image['file'];
- //$data = json_decode(json_decode($t['detail'][0]['image'],true),TRUE);
- //$t['image'] = $data['file'];
- echo "<pre>";
- print_r($t['image']);
- echo "</pre>";
- if(!$t['detail']) {
- $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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement