nuvalis/mzflash
Composer 安装命令:
composer require nuvalis/mzflash
包简介
Session based flash message class. Written for Anax-MVC part of the dbwebb course.
README 文档
README
A PHP Flash Message Class
Installation Instructions for Anax-MVC
Register it as an Anax Service like this in your config/frontcontroller or whatever method you prefer.
$di = new \Anax\DI\CDIFactoryDefault();
// Other Services
$di->setShared('mzflash', function() {
$mzflash = new \nuvalis\Flash\Message();
return $mzflash;
});
// Other Services, Controllers etc.
$app = new \Anax\Kernel\CAnax($di);
$app->session //Start Session for mzFlash to work.
You should now be able to use these functions like this.
// In the Frontcontroller you can do it like this.
$app->mzflash->error("Your Message");
$app->mzflash->success("Your Message");
$app->mzflash->warning("Your Message");
$app->mzflash->message("Your Message");
// If you are in a Controller or Model (Notice the diffrence $app/$this)
$this->mzflash->error("Your Message");
$this->mzflash->success("Your Message");
$this->mzflash->warning("Your Message");
$this->mzflash->message("Your Message");
//To print it out you can use it like this in your Anax-MVC/theme/mytheme/index.tpl.php
<?= $this->mzflash->show(); ?>
// The Output will look something like this
<section class="flash-messages">
<div class="inner">
<div class="flash error">Your Message</div>
<div class="flash success">Your Message</div>
<div class="flash warning">Your Message</div>
<div class="flash message">Your Message</div>
</div>
</section>
Update
[14 May, 2014] Changed variable from flash to mzflash to avoid collision with Anax-MVC's new flash class/service. You can name this service to anything you want.
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-04-28