Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  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. $content_details = array();
  39. $t = array();
  40. $channel_main = $this->config->item("channel_main_id");
  41.  
  42.  
  43. $t['title'] = 'News Portal Kids Now';
  44. $data['read'] = $t['title'] ;
  45. $t['read'] = $this->read->select_data();
  46.  
  47.  
  48.  
  49. $a['v_detail'] = $this->load->view('read/v_detail', $t, true);
  50.  
  51.  
  52. //$this->benchmark->mark('end_view');
  53. $this->load->view("read/v_detail", $t);
  54.  
  55. }
  56.  
  57.  
  58.  
  59.  
  60. public function detail($idartikel) {
  61. $this->load->model('data', 'detail');
  62. $this->load->library('form_validation');
  63. //$t['judul'] = $judul->judul . ' | News Portal';
  64. //$this->db->get_where($this->read, array('judul' => $judul[1]));
  65. $t['title'] = 'News Portal Kids Now';
  66. //$t['title'] = $this->detail->all();
  67. $data['detail'] = $t['title'] ;
  68.  
  69. $t['portofolio'] = $this->detail->all_portofolio(10);
  70.  
  71. //$id = $this->uri->segment(3);
  72. //$t['berita'] = $this->data->get_detail($id);
  73. //$t['tags'] = $this->read->all_hastag();
  74. $t['detail'] = $this->detail->get($idartikel);
  75. //yg diatas panggil http://localhost/web/read/detail/science-portal///
  76. $t['hash_id'] = $t['detail'][0]['idartikel'];
  77. //yg bawah jadinya begini http://localhost/web/read/detail/science-portal/47568/
  78.  
  79. // note saya maunya idnya itu sebelum slug bg
  80.  
  81.  
  82. echo "<pre>";
  83. print_r($t['hash_id']);
  84. echo "</pre>";
  85. if(!$t['detail']) {
  86. $this->load->view(
  87. 'Could not load the requested item',
  88. 'warning'
  89. );
  90. redirect('read');
  91. return;
  92. }
  93.  
  94. $this->load->view("read/v_detail", $t);
  95.  
  96. }
  97.  
  98.  
  99.  
  100.  
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement