Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. ini controlernya
  2. <?php
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. class Blog extends CI_Controller {
  6.  
  7. function __construct()
  8. {
  9. parent::__construct();
  10. $this->load->model('M_Blog');
  11. }
  12.  
  13.  
  14. public function index()
  15. {
  16.  
  17. $this->template->load('Backend/Layout','Backend/Content/v_Blog');
  18.  
  19. }
  20.  
  21. function new_Blog()
  22. {
  23.  
  24. // $this->form_validation->set_rules('title', 'title', 'trim|required');
  25. // $this->form_validation->set_rules('content', 'content', 'trim|required');
  26. // $this->form_validation->set_rules('location', 'location', 'trim|required');
  27.  
  28. // if ($this->form_validation->run() == false ) {
  29. // echo json_encode("wajib di isi");
  30. // } else {
  31. $data = array('title' => $this->input->post('title'),
  32. 'content' => $this->input->post('content'),
  33. 'location' => $this->input->post('location')
  34. );
  35. $object = $this->M_Blog->add_content($data);
  36.  
  37. echo json_encode($object);
  38.  
  39. //}
  40.  
  41.  
  42.  
  43. }
  44. }
  45.  
  46.  
  47. /* End of file filename.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement