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()
- {
- $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->select_data();
- $a['v_detail'] = $this->load->view('read/v_detail', $t, true);
- //$this->benchmark->mark('end_view');
- $this->load->view("read/v_detail", $t);
- }
- 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'] = 'News Portal Kids Now';
- //$t['title'] = $this->detail->all();
- $data['detail'] = $t['title'] ;
- $t['portofolio'] = $this->detail->all_portofolio(10);
- //$id = $this->uri->segment(3);
- //$t['berita'] = $this->data->get_detail($id);
- //$t['tags'] = $this->read->all_hastag();
- $t['detail'] = $this->detail->get($idartikel);
- //yg diatas panggil http://localhost/web/read/detail/science-portal///
- $t['hash_id'] = $t['detail'][0]['idartikel'];
- //yg bawah jadinya begini http://localhost/web/read/detail/science-portal/47568/
- // note saya maunya idnya itu sebelum slug bg
- echo "<pre>";
- print_r($t['hash_id']);
- echo "</pre>";
- if(!$t['detail']) {
- $this->load->view(
- 'Could not load the requested item',
- 'warning'
- );
- redirect('read');
- return;
- }
- $this->load->view("read/v_detail", $t);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement