# 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
<?php if(has_alert()):
foreach(has_alert() as $type => $message): ?>
<div class="alert alert-dismissible <?php echo $type; ?>">
<button type="button" class="close" data-dismiss="alert"><span>×</span></button>
<?php echo $message; ?>
</div>
<?php endforeach;
endif; ?>
Very simple..
Thanks
Tweet your question to @d_nizh
Bahasa Indonesia
http://kabisadenis.net/php/codeigniter/membuat-alert-pada-codeigniter-dengan-mudah/
没有合适的资源?快使用搜索试试~ 我知道了~
用于codeigniter的简单闪存数据警报_PHP_下载.zip
共4个文件
php:2个
yml:1个
md:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 73 浏览量
2023-04-05
13:09:36
上传
评论
收藏 3KB ZIP 举报
温馨提示
用于codeigniter的简单闪存数据警报_PHP_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
用于codeigniter的简单闪存数据警报_PHP_下载.zip (4个子文件)
codeigniter-alert-master
_config.yml 27B
alert_helper.php 497B
README.md 2KB
Alert.php 2KB
共 4 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功