frjf14 / cflashmessage
Class for flash messages.
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-06-18 02:02:36 UTC
README
Flash messages - Anax MVC
cflashmessage handles error, success, notice and warning messages, which can be used to give the user feedback.
License
This software is free software and carries a MIT license.
How to use flash messages
Adding it as shared service in the frontcontroller.
$di->setShared('flashmessage', function() { $flashmessage = new \frjf14\FlashMessage\CFlashMessage(); return $flashmessage; });
From the package Copy the css file: frjf14/cflashmessage/src/css/flashmessage.css to the webroot css folder: webroot/css/ then add the css to the frontcontroller $app->theme->addStylesheet('css/flashmessage.css');
or just link directly to the CSS file within the package $app->theme->addStylesheet('../vendor/frjf14/cflashmessage/src/css/flashmessage.css');
Now you can add flash messages as an example error message: $app->flashmessage->addError('An error message.');
and to display the message use $app->flashmessage->getFlashMessages();
to retrive the message(s) as html.