Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xdn27/codeigniter-alert
An easy flashdata alert for codeigniter
https://github.com/xdn27/codeigniter-alert
codeigniter php
Last synced: 2 months ago
JSON representation
An easy flashdata alert for codeigniter
- Host: GitHub
- URL: https://github.com/xdn27/codeigniter-alert
- Owner: xdn27
- Created: 2015-08-22T18:29:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-26T07:37:35.000Z (over 7 years ago)
- Last Synced: 2024-08-24T01:04:17.764Z (5 months ago)
- Topics: codeigniter, php
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 22
- Watchers: 3
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# codeigniter-alert
An easy flashdata alert for codeigniter
This is just a simple alert..## How To Use
### File
Put the Alert.php in the application/library
Put the alert_helper.php in the application/helper
Load the library automatically..
The library is work with the codeigniter 2.2 and 3.0### Set an Alert
* NAME(String): Your alert name/type/class/whatever..
* MESSAGE(String): Of course this is for the message..
* 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`$this->alert->set(NAME, MESSAGE, NEXT REQUEST);`
### Display an alert
`echo has_alert(NAME);`
`print_r(has_alert());`## Sample
### Controller
public function index()
{
if(!auth_check('member')){
// Alert will show after redirect
$this->alert->set('alert-danger', 'Orang asing dilarang masuk!');
redirect(base_url('auth/login'));
}
redirect(base_url());
}
public function login()
{
if($this->input->post('do_login') AND !$this->do_login()){
// This is not for next request
$this->alert->set('alert-danger', 'Login gagal!', true);
}
$this->load->view('login');
}### View
$message): ?>
×
Very simple..
ThanksTweet your question to @d_nizh
Bahasa Indonesia
http://kabisadenis.net/php/codeigniter/membuat-alert-pada-codeigniter-dengan-mudah/