View difference between Paste ID: niRLZRNi and SLPJVhmG
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($slug) {
72
        $this->load->model('data', 'detail');
73
        $this->load->library('form_validation');
74
       
75
 
76
            $t['read']                  = $this->detail->all(10);
77
            //$t['detail']              = $this->detail->anjing($idartikel);
78
            $t['populer']               = $this->detail->populer();
79
            $t['category']              = $this->detail->kategori();
80
            $t['opini']                 = $this->detail->all_opini(1);
81
            
82
        $t['detail']                    = $this->detail->get($slug);
83
        //$t['title']                     = $t['detail'][0]['title'];
84
        $t['title']                     = $t['detail'][0]['title'];
85
        
86
        //$t['title']                   = (isset($t['detail'][0]['title']) && $t['detail'][0]['title'] = "");
87
        //$t['image']                   = (isset($t['detail'][0]['image']) && $t['detail'][0]['image'] = "");
88
    
89
 
90
        //echo '<pre>';
91
 
92
        //$data = json_decode($t['detail'][0]['image'],true) ;
93
        //print_r($data);
94
 
95
        //$t['image'] = $data['file'];
96
         //$file = json_decode($t['detail'][0]['image']);
97
         //$t['image'] = $file->file;
98
 		if(isset($t['detail'][0]['image'])){
99-
        $raw_image =  json_decode($t['detail'][0]['image'],true);
99+
        	$raw_image =  json_decode($t['detail'][0]['image'],true);
100-
        //$t['image'] = $raw_image['file']; 
100+
101-
        $t['detail'][0]['image'] = $raw_image['file']; 
101+
        	$t['detail'][0]['image'] = $raw_image['file']; 
102-
        var_dump($t['detail'][0]['image']);
102+
        	var_dump($t['detail'][0]['image']);
103-
        //$data                                     = json_decode(json_decode($t['detail'][0]['image'],true),TRUE);
103+
 		}
104-
        //$t['image']                               = $data['file'];
104+
105-
        //echo "<pre>";
105+
//================error lagi deh============
106-
        //print_r($t['image']);
106+
/*
107-
        //echo "</pre>";
107+
108
                'Could not load the requested item',
109
                'warning'
110
            );
111
*/
112
            redirect('read');
113
114-
            return;
114+
115
        
116
       
117
        $this->load->view("read/v_detail", $t);
118
       
119
    }
120
 
121
 
122
 
123
 
124
}