Postingan lainnya
Membuat notifikasi alert di Codeigniter (butuh koreksi)
Halo mastah dan suhu, ane mau tanya.. ini udah bener belum yak Code nya ?
1. Buat alert.php
2.Buat myPage.php
Alert
load->view('alert'); ?>
3. Kemudian buat Controller untuk menangani view
class MyFlashController { function __construct(){ parent::__construct(); $this->load->helper(array('form','url','html')); $this->laod->library(array('pagination','form_validation','encryption','session')); }
public function success(){ $this->session->set_flashdata('success','Berhasil'); return $this->load->view('myPages'); }
public function error(){ $this->session->set_flashdata('error','Gagal'); return $this->load->view('myPages'); }
public function warning(){ $this->session->set_flashdata('warning','Something is wrong'); return $this->load->view('myPages'); }
public function info(){ $this->session->set_flashdata('info','Informasi'); return $this->load->view('myPages'); } }
4. terkhir buat routing nya $route['success-flash'] = 'MyFlashController/success'; $route['error-flash'] = 'MyFlashController/error'; $route['warning-flash'] = 'MyFlashController/warning'; $route['info-flash'] = 'MyFlashController/info';
Itu udah bener belom yak mastah ? thx