helikopterspark / flashmsg
Message controller for ANAX-MVC
v2.0
2015-11-24 20:35 UTC
Requires
- php: >=5.4
- anax/mvc: dev-master
This package is not auto-updated.
Last update: 2024-12-21 19:52:33 UTC
README
FlashMessage
This is a module for the Anax-MVC web framework. The module has been developed as a part of a course on Blekinge Tekniska Högskola.
Flash messages are used to display status messages, results of actions or notices. Use this component to generate these types of messages.
The class FlashMsg uses the session service in Anax-MVC to store the messages until the array is cleared.
#Installation
- To install, use composer.
- Add this line into your composer.json file:
"require": {"helikopterspark/flashmsg": "dev-master"}
- Move or copy the css/flashmsg.css file to the webroot/css folder in your Anax-MVC installation. Modify it to your liking.
- In the router you also need to add the css-stylesheet flashmsg.css.
- You can move or copy the file flashmessages.php to your webroot to test in a web browser.
#Access the controller in your frontcontroller:
$di->setShared('flashmessage', function() use ($di){
$flashMessages = new \helikopterspark\FlashMsg\FlashMsg();
$flashMessages->setDI($di);
return $flashMessages;
});
#Add the route in your frontcontroller:
$app->router->add('', function() use ($app) {
$app->theme->addStylesheet('css/flashmsg.css');
$app->theme->setTitle("Flash messages");
$app->flashmessage->alert('Alert');
$app->flashmessage->error('Error');
$app->flashmessage->info('Info');
$app->flashmessage->notice('Notice');
$app->flashmessage->success('Success');
$app->flashmessage->warning('Warning');
$app->views->add('theme/index', ['content' => $app->flashmessage->outputMsgs()]);
$app->flashmessage->clearMessages();
});