chja/cfmessage
最新稳定版本:v1.0
Composer 安装命令:
composer require chja/cfmessage
包简介
Class for flash messages
README 文档
README
Module that shows flash messages. It handels messages for success, information and errors for the user.
By Christofer Jadelius
###License
This software is free software and carries a MIT license.
###How to install
First you have to include this code in your composer.json file:
"require": { "chja/cfmessage": "dev-master" },
###How to use with Anax/MVC
After you have downloaded the package add this code to your front-controller:
$di->set('Cfmessage', function() use ($di) { $message = new \Chja\Cfmessage\CfmessageAnax(); $message->setDI($di); return $message; });
Note: Before you start adding messages you will have to start a session if you have not done that yet.
Now you can start adding all the messages you want to use. below you can see some examples.
Info messages:
$app->Cfmessage->addNotice('This is an information message');
Error messages:
$app->Cfmessage->addError('This is an error message');
success messages:
$app->Cfmessage->addSuccess('This is a success message');
warning messages:
$app->Cfmessage->addWarning('This is a warning message');
When a message has been added it will be saved in the session, use these lines to print the message/messages:
$messages = $app->Cfmessage->printMessage(); $app->views->addString($messages);
You can also clear the session by invoking this method:
$app->Cfmessage->clearSession();
All the messages are using icons from Font Awesome. Font Awesome is not required but the meaning of the messages will be a little bit clearer if you use it.
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-14