承接 tijo15/flash-message 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tijo15/flash-message

Composer 安装命令:

composer require tijo15/flash-message

包简介

Flashmessage module for anax mvc

关键字:

README 文档

README

Scrutinizer Code Quality Code Coverage Build Status

Flash messages

School project to create a module for the Anax MVC framework.

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.

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

How to install

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

  2. To access the controller use this in your frontcontroller:

// Include the essential settings.

require DIR.'/config.php';

// Create services and inject into the app.

$di = new \Anax\DI\CDIFactoryDefault();

// Adds the Flash controller

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

How to use

Add the route in your front controller:

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

$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(),
    ]); 

});

If you want to add a new message you need to add a background color to flash.css like this

.newmsg { background-color:#f0cb11; }

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');

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-22