├── _config.yml
├── alert_helper.php
├── README.md
└── Alert.php
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-minimal
--------------------------------------------------------------------------------
/alert_helper.php:
--------------------------------------------------------------------------------
1 | alert->has_alert($type);
20 |
21 | if(!empty($alerts)){
22 | return $alerts;
23 | }
24 |
25 | return false;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # codeigniter-alert
2 | An easy flashdata alert for codeigniter
3 | This is just a simple alert..
4 |
5 | ## How To Use
6 |
7 | ### File
8 | Put the Alert.php in the application/library
9 | Put the alert_helper.php in the application/helper
10 | Load the library automatically..
11 |
12 | The library is work with the codeigniter 2.2 and 3.0
13 |
14 | ### Set an Alert
15 | * NAME(String): Your alert name/type/class/whatever..
16 | * MESSAGE(String): Of course this is for the message..
17 | * NEXT REQUEST(Bool / Default: false): Set TRUE if not for next request.. I think you now about this if you have use a flashdata codeigniter
18 |
19 | `$this->alert->set(NAME, MESSAGE, NEXT REQUEST);`
20 |
21 | ### Display an alert
22 | `echo has_alert(NAME);`
23 | `print_r(has_alert());`
24 |
25 | ## Sample
26 |
27 | ### Controller
28 |
29 | public function index()
30 | {
31 | if(!auth_check('member')){
32 |
33 | // Alert will show after redirect
34 | $this->alert->set('alert-danger', 'Orang asing dilarang masuk!');
35 | redirect(base_url('auth/login'));
36 | }
37 |
38 | redirect(base_url());
39 | }
40 |
41 | public function login()
42 | {
43 | if($this->input->post('do_login') AND !$this->do_login()){
44 |
45 | // This is not for next request
46 | $this->alert->set('alert-danger', 'Login gagal!', true);
47 | }
48 |
49 | $this->load->view('login');
50 | }
51 |
52 | ### View
53 |
54 | $message): ?>
56 |