2017 © Pedro Peláez
 

library flash-message

Flashmessage module for anax mvc

image

tijo15/flash-message

Flashmessage module for anax mvc

  • Thursday, October 29, 2015
  • by tijo15
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Scrutinizer Code Quality Code Coverage Build Status, (*1)

Flash messages

School project to create a module for the Anax MVC framework., (*2)

Flash Messages lets you add flash messages to the Anax mvc. There are 4 different messages which has a css design to them: Approved, Information, Error and Warning., (*3)

You can easily add your own messages but you have to specify the design for them in the flash.css file., (*4)

How to install, (*5)

  1. To install, use composer and add this line: "require": {"tijo15/flash-message": "dev-master" }, (*6)

  2. To access the controller use this in your frontcontroller:, (*7)

// Include the essential settings., (*8)

require DIR.'/config.php';, (*9)

// Create services and inject into the app., (*10)

$di = new \Anax\DI\CDIFactoryDefault();, (*11)

// Adds the Flash controller, (*12)

$di->setShared('flashMessages', function() use ($di){ $flashMessages = new tijo15\FlashMessage\FlashController($di); return $flashMessages; });, (*13)

How to use, (*14)

Add the route in your front controller:, (*15)

// Test Route $app->router->add('', function() use ($app) {, (*16)

$app->theme->setTitle("Testing flash"); 

//Code to test each message, including a default message(Test). 
$app->flashMessages->addMessage('Godkänt!', 'success');
$app->flashMessages->addMessage('Information', 'info');
$app->flashMessages->addMessage('Varning!', 'warning');
$app->flashMessages->addMessage('Error', 'error');
$app->flashMessages->addMessage('Test', 'Test');

//Adds the view to display the messages
$app->views->add('flash/flash', [ 
    'content' => $app->flashMessages->getFlashMessages(),
    ]); 

});, (*17)

If you want to add a new message you need to add a background color to flash.css like this, (*18)

.newmsg { background-color:#f0cb11; }, (*19)

Make sure that the name in the css corresponds to the name in the addMessage function like this: $app->flashMessages->addMessage('Test new msg', 'newmsg');, (*20)

The Versions

29/10 2015

dev-master

9999999-dev https://github.com/tijo15/flashmessages

Flashmessage module for anax mvc

  Sources   Download

MIT

The Requires

 

by Tim J-H

flashmessages